next up previous contents index
Next: 20.2 Random Variables Up: 20.1 Random Number Generation Previous: 20.1.0.0.2 Seeding the random

20.1.0.0.3 OTcl support

The RNG class can be accessed from OTcl. For example, a new RNG is created and seeded with:

set rng [new RNG]
$rng seed 0 # seeds the RNG heuristically;
$rng seed n # seeds the RNG with value n;
$rng next-random #  return the next random number;
$rng uniform a b # return a number uniformly distributed on [a, b];
$rng integer k # return an integer uniformly distributed on [0, (k-1)];
$rng exponential # return a number from an exponential distribution with average 1.;

Currently there is no way to select predefined seeds from OTcl.




2000-08-24