Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4973 | right-hear | 1 | /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ |
2 | #include |
||
3 | |||
4 | static unsigned long long next = 0; |
||
5 | |||
6 | int |
||
7 | rand(void) |
||
8 | { |
||
9 | next = next * 1103515245L + 12345; |
||
10 | next = (next<<15) ^ (next >> 27); |
||
11 | return (int)((next >> 4) & RAND_MAX); |
||
12 | } |
||
13 | |||
14 | void |
||
15 | srand(unsigned seed) |
||
16 | { |
||
17 | next = seed; |
||
18 | }15)><15)> |