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

Random numbers

Random numbers are supported through the random_stream interface.

In randstream.cecil:


template object random_stream isa stream[int]; 
method peek_next(t@:random_stream, at_end:&():int):int; 
method next(t@:random_stream, at_end:&():int):int; 
method is_at_end(@:random_stream):bool; 
method new_rand_stream(i:int):random_stream; 
method new_rand_stream(i:int, j:int):random_stream; 
method random_vector(len:int, range:int):vector[int]; 
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.


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

The Cecil project