Newsgroups: comp.theory,comp.ai.genetic,comp.ai
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!fas-news.harvard.edu!newspump.wustl.edu!news.ecn.bgu.edu!news.moneng.mei.com!hookup!news.mathworks.com!uunet!sparky!kwiudl.kwi.com!thowlandpc
From: tom@kwi.com (Tom Howland)
Subject: Re: wanted: FAST binary random number gene
Message-ID: <3kq1f2$qg_001@kwi.com>
Sender: usenet@kwiudl.kwi.com
Organization: Sterling, Inc.
X-Newsreader: News Xpress Version 1.0 Beta #3
References: <3k6tp7$t13@vixen.cso.uiuc.edu> <1995Mar16.135500.22980@news.unige.ch> <3kkgt8$1oh@explorer.csc.com>
Date: Wed, 22 Mar 1995 23:30:32 GMT
Lines: 30
Xref: glinda.oz.cs.cmu.edu comp.theory:12050 comp.ai.genetic:5386 comp.ai:28374

This is nonsense. Random numbers were figured out a long time ago. I
defy anyone to come up with a faster version.


/*  This is an implementation of algorithm AS 183 from the journal
    "Applied Statistics".

    random() returns a random number between 0.0 and 1.0
*/

static  int     A = 27134,
                B =  9213,
                C = 17773;
static  int     S = 0x19551011;


double random() {
  double T = (A = (A*171) % 30269)/30269.0
    + (B = (B*172) % 30307)/30307.0
      + (C = (C*170) % 30323)/30323.0;
  return T-(int)T;
}

Tom Howland                             Internet mailing address: tom@kwi.com
Senior Software Engineer                FAX:   +1 415 802 7143
Sterling Software, Incorporated         Phone: +1 415 802 7100 extension 2072
303 Twin Dolphin Drive, Suite 600       Voice Mail:    +1 415 802 7125
Redwood City, California 94065-1417     Long Distance: +1 800 964 0154

world wide web page: http://www.rahul.net/tom
