Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mordor.UUCP Path: utzoo!watmath!clyde!burl!ulysses!harpo!seismo!ut-sally!mordor!earl From: earl@mordor.UUCP Newsgroups: net.unix-wizards Subject: random() Message-ID: <2514@mordor.UUCP> Date: Fri, 20-Apr-84 16:09:21 EST Article-I.D.: mordor.2514 Posted: Fri Apr 20 16:09:21 1984 Date-Received: Sat, 21-Apr-84 02:37:14 EST Organization: S-1 Project, LLNL Lines: 24 A recent message to this news group contained some misleading information about the random number generator random() which is part of libc.a in 4.2BSD. While it is true that there is a bug in random() as distributed, it is not true that there are "some subtle bugs". The bug is a static initialization problem which affected the default geneartion of random numbers (if you call initstate(), the problem disappears). It is also not true that random() generates "poor" random numbers (if initstate() is called or if the bug is fixed). I have done some fairly extensive testing of random() (using tests mainly from Knuth vol. 2), and it does as well or better than anything else I've looked at which runs in comparable time. The fix is: ------- random.c ------- 145c145 < static long *state = &randtbl[ -1 ]; --- > static long *state = &randtbl[ 1 ]; ------------------------ Earl Cohen earl@s1-c ...!decvax!decwrl!mordor!earl