lemon-project-template-glpk

view deps/glpk/src/glprng.h @ 9:33de93886c88

Import GLPK 4.47
author Alpar Juttner <alpar@cs.elte.hu>
date Sun, 06 Nov 2011 20:59:10 +0100
parents
children
line source
1 /* glprng.h (pseudo-random number generator) */
3 /***********************************************************************
4 * This code is part of GLPK (GNU Linear Programming Kit).
5 *
6 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
7 * 2009, 2010, 2011 Andrew Makhorin, Department for Applied Informatics,
8 * Moscow Aviation Institute, Moscow, Russia. All rights reserved.
9 * E-mail: <mao@gnu.org>.
10 *
11 * GLPK is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * GLPK is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19 * License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with GLPK. If not, see <http://www.gnu.org/licenses/>.
23 ***********************************************************************/
25 #ifndef GLPRNG_H
26 #define GLPRNG_H
28 typedef struct RNG RNG;
30 struct RNG
31 { /* Knuth's portable pseudo-random number generator */
32 int A[56];
33 /* pseudo-random values */
34 int *fptr;
35 /* the next A value to be exported */
36 };
38 #define rng_create_rand _glp_rng_create_rand
39 RNG *rng_create_rand(void);
40 /* create pseudo-random number generator */
42 #define rng_init_rand _glp_rng_init_rand
43 void rng_init_rand(RNG *rand, int seed);
44 /* initialize pseudo-random number generator */
46 #define rng_next_rand _glp_rng_next_rand
47 int rng_next_rand(RNG *rand);
48 /* obtain pseudo-random integer in the range [0, 2^31-1] */
50 #define rng_unif_rand _glp_rng_unif_rand
51 int rng_unif_rand(RNG *rand, int m);
52 /* obtain pseudo-random integer in the range [0, m-1] */
54 #define rng_delete_rand _glp_rng_delete_rand
55 void rng_delete_rand(RNG *rand);
56 /* delete pseudo-random number generator */
58 #define rng_unif_01 _glp_rng_unif_01
59 double rng_unif_01(RNG *rand);
60 /* obtain pseudo-random number in the range [0, 1] */
62 #define rng_uniform _glp_rng_uniform
63 double rng_uniform(RNG *rand, double a, double b);
64 /* obtain pseudo-random number in the range [a, b] */
66 #endif
68 /* eof */