Crossings Minimization  1.0
random.h
Go to the documentation of this file.
1 /*
2  * Mersenne Twister (MT19937) - Header File
3  * Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura
4  * http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
5  * email: m-mat [at] math.sci.hiroshima-u.ac.jp
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * 3. The names of its contributors may not be used to endorse or promote
20  * products derived from this software without specific prior written
21  * permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
27  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef __RANDOM_H
37 #define __RANDOM_H
38 
39 
40 /* Generator intialization. */
41 void init_genrand(unsigned long s);
42 void init_by_array(unsigned long init_key[], int key_length);
43 
44 /* Random integer generation. */
45 unsigned long genrand_int32(void);
46 long genrand_int31(void);
47 
48 /* Random real number generation. */
49 double genrand_real1(void); /* [0,1] */
50 double genrand_real2(void); /* [0,1) */
51 double genrand_real3(void); /* (0,1) */
52 double genrand_res53(void); /* [0,1) with 53-bit resolution */
53 
54 /**
55  * Added by Matthias Stallmann
56  * $Id: random.h 96 2014-09-09 16:37:16Z mfms $
57  */
58 
59 /**
60  * PRE: A is an array of 'length' items, each of which is 'element_size'
61  * bytes long.
62  * POST: A has been randomly permuted
63  */
64 void genrand_permute( void * A, int length, int element_size );
65 
66 /**
67  * PRE: A is an array of 'length' items, each of which is 'element_size'
68  * bytes long.
69  * POST: A has been randomly permuted
70  * retval == an allocated array of int's containing the actual
71  * permutation: the old A[retval[i]] is now at A[i]
72  * To restore the array A back to its original state, do
73  * for( i = 0; i < length; ++i ) {
74  * B[ i ] = A[ i ]; where B is an array of the same type as A
75  * }
76  * for( i = 0; i < length; ++i ) {
77  * A[ retval[ i ] ] = B[ i ];
78  * }
79  */
80 int * genrand_permutation( void * A, int length, int element_size );
81 
82 
83 #endif /* __RANDOM_H */
84 
85 
86 /* [Last modified: 2014 09 09 at 16:04:00 GMT] */
void genrand_permute(void *A, int length, int element_size)
Definition: random.c:183
double genrand_res53(void)
Definition: random.c:170
int * genrand_permutation(void *A, int length, int element_size)
Definition: random.c:198
void init_by_array(unsigned long init_key[], int key_length)
Definition: random.c:73
double genrand_real1(void)
Definition: random.c:146
long genrand_int31(void)
Definition: random.c:139
double genrand_real3(void)
Definition: random.c:162
unsigned long genrand_int32(void)
Definition: random.c:100
void init_genrand(unsigned long s)
Definition: random.c:53
double genrand_real2(void)
Definition: random.c:154