Thread View: news.software.readers
1 messages
1 total messages
Started by da... John E. Davis
Sat, 22 Jan 2000 00:00
Re: [slrn] Random values
Author: da... John E. Davis
Date: Sat, 22 Jan 2000 00:00
Date: Sat, 22 Jan 2000 00:00
21 lines
1219 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads