Flashnux

GNU/Linux man pages

Livre :
Expressions régulières,
Syntaxe et mise en oeuvre :

ISBN : 978-2-7460-9712-4
EAN : 9782746097124
(Editions ENI)

Unix

Unix v6

rand(3)



rand, srand random number generator (seed in r0)

jsr

pc,srand

/to initialize jsr

pc,rand

/to get a random number

srand(seed)
int seed;
rand( )

uses a multiplicative congruential random number generator to return successive pseudo-random numbers (in r0) in the range from 0 to 2 15 1. The generator is reinitialized by calling with 1 as argument (in r0). It can be set to a random starting point by calling with whatever you like as argument, for example the low-order word of the time. The low-order bits are not very random.



rand(3)