🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #57070

Re: [slrn] Random values

#57070
From: da... John E. Davis
Date: Sat, 22 Jan 2000 00:00
21 lines
1219 bytes
On 22 Jan 2000 17:50:18 -0000, Gary Jones <Anonymous-Remailer@See.Comment.Header>
wrote:
>How does one go about getting "random" values in s-lang? I've looked through

Try this:
#v+
static variable R = _time ();
define random ()
{
   R = R * 69069UL + 1013904243UL;
   return R / 4294967296.0;
}
#v-
This will produce a pseudo-random number uniformly distributed on
[0,1).  It is not the best generator in the world but unless you are
trying to write a monte carlo simulation for slrn, it should be good
enough.

--John
Technical Details
Message-ID: <slrn88jvck.djd.davis@aluche.mit.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mail
References: <200001221746.RAA09715@berlin.neuropa.net>

Show Full Headers
Complete Article Headers
Message-ID: <slrn88jvck.djd.davis@aluche.mit.edu>
Subject: Re: [slrn] Random values
Date: Sat, 22 Jan 2000 00:00:00 +0000
From: da...@space.mit.edu (John E. Davis)
References: <200001221746.RAA09715@berlin.neuropa.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mail
X-Deja-AN: 576221824
X-Trace: dreaderd 948567466 22493 18.75.2.45
Organization: Center for Space Research
User-Agent: slrn/0.9.6.2 (Linux)
Reply-To: da...@space.mit.edu
Newsgroups: alt.lang.s-lang,news.software.readers