On Sat, 23 May 1998, Jakob Andreas Baerentzen wrote:
>On Wed, 20 May 1998, R. Brock Lynn wrote:
>> 
>> It is supposed to generate random integers in a certain range specified by two
>> endpoints inclusive. i.e.: randomit 10 100 will send to stdout a random long int
>> between 10 and 100. should work for negative numbers too.
>> 
>> My code is included. Please give me some comments!
>
>There is one little problem that I have run into before
>
>
>  srand ( time ( 0 ) ) ;
>
>initializes the random number generator with the current time - and the
>time is measured in seconds. This means that if you call randomit two
>times during one second, you get the same random number.
>
>You should, probably, use
>
>srand(times(0));
>
>times(0) returns the number of clock ticks since system was brought up,
>and ``a tick'' seems to be one hundredth of a second.
>
>Andreas

Reply via email to