Re: rand() nicht zuf?llig?!

From: Oliver Fromme <olli(at)secnetix.de>
Date: Sat, 24 May 2003 00:00:03 +0200 (CEST)

Robert Lillack <rob(at)lillack.de> wrote:
> hat jemand eine Ahnung, warum mir
>
> srand(666);
> while(1) {
> printf("%i\n", rand()%2);
> }
>
> unter NetBSD 1.6.1 (gcc 2.95.3) immer abwechselnd Nullen
> und Einsen liefert, was irgendwie nicht nach Zufall
> aussieht. Muss ich "den Zufall" erst irgendwie aktivieren?!

rand() liefert halt keine besonders guten Zufallszahlen.
In FreeBSDs manpage steht auch ausdrücklich: »These
interfaces are obsoleted by random(3).« Versuch's mal
mit random(); ich wette, das sieht besser aus.

Gruß
   Olli

-- 
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.
Cryptography is about mathematics; security is about people.
       -- Bruce Schneier
To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-bsd-questions" in the body of the message
Received on Sat 24 May 2003 - 00:00:07 CEST

search this site