[gameprogrammer] Re: Making random numbers in C++

  • From: "milos chmel" <xchmelmilos@xxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Wed, 31 Dec 2008 21:16:05 +0100

Azeem,
he talks about something like:
srand(time(0));
for (i = 0; i < 1000; ++i)
     rand();
2008/12/31, Brian <brian.ripoff@xxxxxxxxx>:
> That should not happen. Can you post a complete example that
> demonstrates this behaviour. My computer can generate a million random
> numbers in a handful of milliseconds, according to a quick,
> unoptimised program I threw together, compiled without optimisation
> either.
>
> On Wed, Dec 31, 2008 at 7:53 PM, Azeem Zaheer <azeem_841@xxxxxxxxxxx> wrote:
>> I am making a program in which I need about 10,000 "random" numbers
>> ranging
>> from 1 to 10.I have to make it in
>> C++.So, when I use srand(time(NULL)); it works..but it is tooo slow.
>> I takes 1 whole second to process and generate 1 number.
>> I will have to wait 1000 secs, which is hell of a time.Please suggest me
>> someway to make random numbers
>> more quicker.Just tell me how to make 1 random number in 1 millisecond or
>> even less.
>
-- 
"Brevity is the soul of wit." by William Shakespeare
" It IS NOT all FACTS. It IS TRUE. I believe it SHOULD NOT BE BELIEVE
LITERALLY. It IS TRUE."  - jorgipogi

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: