Re: An Applied Algorithmic Activity:
----- Original Message -----
From: "Patrick Barnes"
Sent: Wednesday, June 30, 2004 4:48 AM
Subject: Re: An Applied Algorithmic Activity:
> > is this a function - which is from Jiri Babor - which might be helpful
> > for you?:
...
> Unfortunately no, because of the randomness in it. The thing needs to
> be reproducible again.
>
> --
> MrTrick
include machine.e
set_rand(i1)
Set the random number generator to a certain state, i1, so that you will get
a known series of random numbers on subsequent calls to rand().
function shuffle(sequence s, integer seed)
object temp
integer j
set_rand(seed)
for i = length(s) to 2 by -1 do
j = rand(i)
temp = s[j]
s[j] = s[i]
s[i] = temp
end for
return s
end function
unkmar
|
Not Categorized, Please Help
|
|