No matter where I insert either version I always get the same final list. 7?7 1 4 5 0 6 2 3 10?10 5 1 3 2 4 0 7 8 6 9 NB.m3=: 9!:1@<.@(+/ .^&2@(6!:0@])) NB.Randomizing random number seed 16!:45 16!:45 7?7 1 5 6 4 0 2 3 10?10 4 3 1 6 7 9 5 2 0 8 10?10 9 0 1 6 4 2 3 8 5 7 Linda
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of tom arneson Sent: Friday, November 28, 2014 10:29 PM To: [email protected] Subject: Re: [Jprogramming] Get unique results each time you use deal and roll Linda, Run m3 and it sets the seed of the random number generator (RNG) to new values based on the time. Do this before you start to generate random numbers. With a new seed you'll get a different sequence of RNs. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Linda Alvord Sent: Friday, November 28, 2014 21:03 To: [email protected] Subject: Re: [Jprogramming] Get unique results each time you use deal and roll This agrees with {Pascal's answer. I thought you could take some number of seconds in the time and find the last digits or something and then roll that number and then begin your code. Maybe I isn't possible. Linda -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of tom arneson Sent: Friday, November 28, 2014 9:16 PM To: [email protected] Subject: Re: [Jprogramming] Get unique results each time you use deal and roll Try this, from: http://www.jsoftware.com/jwiki/JPhrases/RandomNumbers m3=: 9!:1@<.@(+/ .^&2@(6!:0@])) NB.Randomizing random number seed -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Linda Alvord Sent: Friday, November 28, 2014 19:01 To: [email protected] Subject: [Jprogramming] Get unique results each time you use deal and roll 7?7 1 4 5 0 6 2 3 10?10 5 1 3 2 4 0 7 8 6 9 Now run the code again after closing J and you get the same results. How can you get different results each time. I vaguely rember using some date or other number with roll to insure different results. Linda ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
