default random object?

Lionello Lunesu lionello at lunesu.remove.com
Sun Feb 15 20:56:34 PST 2009


"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message 
news:gnafec$1cko$1 at digitalmars.com...
> Ok. Let me just note that rand()%max is a lousy method of generating 
> random numbers between 0 and max-1 and everybody should put that in the 
> bin with Popular Examples That Should Never Be Used, together with 
> exponential Fibonacci, linear-space factorial, and bubblesort.

Yes yes, I know I know, but, honestly, when I'm generating noise for some 
terrain generation or a random color, or some fuzzy AI behaviour, I don't 
care about random periods that much and %max does the job. Nobody is using 
%max for private key generation, AFAIK :)

L. 




More information about the Digitalmars-d mailing list