Author: Andrey A. Chernov
Email: [EMAIL PROTECTED]
Message:
> 2) Seeding RNG from time() only often produce the same number since rand() formulae
>not vary much from small seed changes, so the line:
>
> srand((unsigned)tclock);
>
> should be changed to something like
>
> srand((unsigned)(tclock^getpid()));
My test shows that XOR getpid() is not efficient enough because only low bits are
changed, so first rand() result still not differs much. The next variant provides even
better seeding since change high bytes too:
srand((unsigned)(tclock^(getpid()<<16)));
Reply: <http://search.mnogo.ru/board/message.php?id=2080>
___________________________________________
If you want to unsubscribe send "unsubscribe general"
to [EMAIL PROTECTED]