random number generator

Michael P. baseball.mjp at gmail.com
Wed Jul 30 12:28:14 PDT 2008


Okay. so I'm trying to make a simple Guess the Number game in D, and I need to know how to generate random number. (I'm pretty much done the other parts of the game)
In C++, I would seed the random number generator with:
srand( time( 0 ) ); 
and the generate a random number from 1-10 with:
randomnumber = ( rand() % 10 ) + 1;

How would I go about doing the same thing in D?
-Michael P.


More information about the Digitalmars-d-learn mailing list