| 63 | } |
| 64 | |
| 65 | void lsrand (unsigned long initial_seed) |
| 66 | { |
| 67 | // this function initializes the random seed based on the initial seed value |
| 68 | // passed in the initial_seed parameter. Since random seeds are |
| 69 | // usually initialized with the time of day, and time is a value that |
| 70 | // changes slowly, we bump the seed twice to have it in a more |
| 71 | // random state for future calls of the random number generator. |
| 72 | |
| 73 | // fill in the initial seed of the random number generator |
| 74 | lseed = (long) initial_seed; |
| 75 | lseed = lrand (); // bump it once |
| 76 | lseed = lrand (); // bump it twice |
| 77 | return; // that's all folks |
| 78 | } |
| 79 | |
| 80 | long RandomLong (long from, long to) |
| 81 | { |