[futurebasic] Re: [FB] Re-negotiable Noise

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2004 : Group Archive : Group : All Groups

From: Jay Reeve <jayreeve@...>
Date: Mon, 19 Apr 2004 21:24:50 -0500
On Monday, April 19, 2004, at 08:17  PM, Robert Covington wrote:

> The needed unique feature from this, or any other random generator I 
> am seeking, is that you get the same number back out if you ship it 
> the same seed value.
>
Cov,

FB's  RND provides exactly what you need. I've put a wrapper on it to 
create numbers in the range 0.0 - 0.9999694824.
The demo proves it returns the same each pass with the same input. 
(Different input is used each time you run the demo.)

You should also be aware that after seeding with RANDOM(seed), the 
sequence of subsequent numbers returned (without reseeding) will always 
be the same for the same initial seed.

  e-e
  =J= a  y
   "

local fn realRND#(seed&)
random(seed)
end fn = (rnd(_maxint) - 1.0) / _maxInt

// DEMO
dim s,start,add
start = rnd(9999)

print
print " Seed"," FN realRnd#(Seed)"// =";start + 1;" to";start + 15
for s = 1 to 15
print start + s, fn realRnd#(start + s)
next

print
print " Seed"," FN realRnd#(Seed)"// =";start + 1;" to";start + 15
for s = 1 to 15
print start + s, fn realRnd#(start + s)
next

--
To unsubscribe, send ANY message to: futurebasic-unsubscribe@...