File: random.h

package info (click to toggle)
joe 2.8-12
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,136 kB
  • ctags: 1,764
  • sloc: ansic: 18,799; asm: 224; makefile: 122; sh: 9
file content (38 lines) | stat: -rw-r--r-- 742 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* Berkeley random number generator */

#ifndef _Irandom
#define _Irandom 1

#include "config.h"

/* x**31 + x**3 + 1.  */
#define	DEG 31
#define	SEP 3

struct state
 {
 long state[DEG];
 long *fptr;
 long *rptr;
 };

/* State information.  You can save and restore this variable */
extern struct state state;

/* long random(void);
 * Return 31 bit pseudo-random number
 */
long random();

/* void srandom(int seed);
 *
 * Initialize random number generator with specified seed
 *
 * Note that values returned by 'random' are not the entire state, and
 * therefore can not be used as seeds to 'srandom' to revert to a previous
 * state.  Instead, save and restore the entire variable 'state' for this
 * purpose.
 */
void srandom();

#endif