Re[2]: Random function
- Posted by aku at inbox.as Mar 08, 2001
- 350 views
Thanks very very much!!! J> function shuffle(sequence s) J> object temp J> integer j J> for i = length(s) to 2 by -1 do J> j = rand(i) J> temp = s[j] J> s[j] = s[i] J> s[i] = temp J> end for J> return s J> end function J> ----- Original Message ----- J> From: <aku at inbox.as> J> To: "EUforum" <EUforum at topica.com> J> Sent: Friday, March 09, 2001 1:33 AM J> Subject: Random function >> How I can make function that accept sequence as input >> for example {1,2,3,4,5,6,7,7.5,10,50,100} and output >> that sequence but in random order such as >> {5,100,4,7.5,7,1,2,50,10,3,6} as efficient as possible? >> >> Thanks! >> >> >> >>