1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /*                                                                           */
3 /*                  This file is part of the program and library             */
4 /*         SCIP --- Solving Constraint Integer Programs                      */
5 /*                                                                           */
6 /*    Copyright (C) 2002-2021 Konrad-Zuse-Zentrum                            */
7 /*                            fuer Informationstechnik Berlin                */
8 /*                                                                           */
9 /*  SCIP is distributed under the terms of the ZIB Academic License.         */
10 /*                                                                           */
11 /*  You should have received a copy of the ZIB Academic License              */
12 /*  along with SCIP; see the file COPYING. If not visit scipopt.org.         */
13 /*                                                                           */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file   scip_randnumgen.h
17  * @ingroup PUBLICCOREAPI
18  * @brief  public methods for random numbers
19  * @author Tobias Achterberg
20  * @author Timo Berthold
21  * @author Thorsten Koch
22  * @author Alexander Martin
23  * @author Marc Pfetsch
24  * @author Kati Wolter
25  * @author Gregor Hendel
26  * @author Leona Gottwald
27  */
28 
29 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
30 
31 #ifndef __SCIP_SCIP_RANDNUMGEN_H__
32 #define __SCIP_SCIP_RANDNUMGEN_H__
33 
34 
35 #include "scip/def.h"
36 #include "scip/type_misc.h"
37 #include "scip/type_retcode.h"
38 #include "scip/type_scip.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /**@addtogroup RandomNumbers
45  *
46  * @{
47  */
48 
49 /** creates and initializes a random number generator
50  *
51  *  @note The initial seed is changed using SCIPinitializeRandomSeed()
52  */
53 SCIP_EXPORT
54 SCIP_RETCODE SCIPcreateRandom(
55    SCIP*                 scip,               /**< SCIP data structure */
56    SCIP_RANDNUMGEN**     randnumgen,         /**< random number generator */
57    unsigned int          initialseed,        /**< initial random seed */
58    SCIP_Bool             useglobalseed       /**< should SCIP's global seed be used to initialise the supplied seed? */
59    );
60 
61 /** frees a random number generator */
62 SCIP_EXPORT
63 void SCIPfreeRandom(
64    SCIP*                 scip,               /**< SCIP data structure */
65    SCIP_RANDNUMGEN**     randnumgen          /**< random number generator */
66    );
67 
68 /** initializes a random number generator with a given seed
69  *
70  *  @note The seed is changed using SCIPinitializeRandomSeed()
71  */
72 SCIP_EXPORT
73 void SCIPsetRandomSeed(
74    SCIP*                 scip,               /**< SCIP data structure */
75    SCIP_RANDNUMGEN*      randnumgen,         /**< random number generator */
76    unsigned int          seed                /**< new random seed */
77    );
78 
79 
80 /** modifies an initial seed value with the global shift of random seeds */
81 SCIP_EXPORT
82 unsigned int SCIPinitializeRandomSeed(
83    SCIP*                 scip,               /**< SCIP data structure */
84    unsigned int          initialseedvalue    /**< initial seed value to be modified */
85    );
86 
87 /**@} */
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 
93 #endif
94