[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: luuid vs. forks
- From: Alexander Gladysh <agladysh@...>
- Date: Tue, 9 Feb 2010 00:50:16 +0300
>> This looks wrong to me. Also it (indirectly) breaks my tests. So I want to
>> ask — is this normal, or my setup is broken?
> it _is_ very wrong. what happens if you run the program a second
> time? do you get the same sequence? or is it different each time but
> the same on both forks()?
I get different sequences each time I run the program. But they are
the same on both forks.
> if it's the same sequence on each time, you have to seed the
> pseudorandom generator (PRG). it's a common pitfall on most PRGs.
> (others auto-seed on first use if you don't do it yourself, usually
> with a time-microdependent value)
> if it's different each time, but always the same on both forks, you
> have to figure where are you seeding the PRG and make sure it happens
> _after_ the fork (or that it happens again, with a different seed, of
Thank you. But, unfortunately, I do not see a way to seed libuuid's
PRG at all. It seems that the library does that by itself.