next up previous index
Next: Unix files Up: Input/output Previous: stream_views ; view_stream   Index

Random numbers

Random numbers are supported through the random_stream interface.

In randstream.diesel:

A random_stream is an infinitely-long stream of ints in the range 0 to range-1 inclusive. The initial seed of the random stream can be set upon creation, to generate reproducible random streams. (But multiple random streams cannot each have their own seed set independently! There's a single global seed shared by all random streams.)

extend module Stdlib;
module RandomStream;
class random_stream isa stream[int];
fun get_rand():int;
fun set_rand_seed(i:int):void;
fun new_rand_stream(i:int):random_stream;
fun new_rand_stream(i:int, j:int):random_stream;
fun random_vector(len:int, range:int):vector[int];
end module RandomStream;


next up previous index
Next: Unix files Up: Input/output Previous: stream_views ; view_stream   Index

Cecil/Vortex Project