Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

random in c/c++

2 views
Skip to first unread message

Christian Beckhoff

unread,
Mar 20, 2002, 8:05:23 AM3/20/02
to
Hi all,

I set up my random generator like this:

srand(time(NULL));

I wrote a function, that returned random ints, but htis function was called
multiple time per second and it always returned the same numbers. I think
it is seeded with the seonds of my system clock

How can I seed it on milliseconds, I really need tk know, my program
depends on differnet random numbers

Thanks for your help in Advance
Best regards
Christian

Wolfgang Schulz

unread,
Mar 20, 2002, 1:34:46 PM3/20/02
to
Hallo Christian,

On Wed, 20 Mar 2002 14:05:23 +0100, Christian Beckhoff
<christia...@gmx.de> wrote:

>How can I seed it on milliseconds, I really need tk know, my program
>depends on differnet random numbers

Hm, hört sich nach Deiner Beschreibung ok an. Kannst Du mal den Code
posten?


Und wech,

Wolfgang Schulz

--

e-Mail: Wolfgang.Sc...@nexgo.de

lhal...@twcny.rr.com

unread,
Mar 21, 2002, 4:14:49 PM3/21/02
to

"Christian Beckhoff" <christia...@gmx.de> wrote in message
news:Xns91D78F4EA...@62.153.159.134...

Martin F.

unread,
Apr 19, 2002, 2:24:33 PM4/19/02
to
"Christian Beckhoff" <christia...@gmx.de> wrote in message
news:Xns91D78F4EA...@62.153.159.134...

Don't call srand everytime the function is called; call it only once
at the start of you program.


0 new messages