Random Integers, No Repeats
|
08-09-2023, 05:10 PM
Post: #9
|
|||
|
|||
RE: Random Integers, No Repeats
(08-09-2023 04:59 PM)nickapos Wrote:(08-09-2023 04:54 AM)Joe Horn Wrote: If you don't mind using an undocumented but stable CAS function, rand(X,Y,Z) returns X random integers between Y and Z without repeats. Example: rand(10,50,59) returns all 10 integers between 50 and 59 in random order. It's faster than creating an array and then shuffling it. rand(10000,1,10000) takes only 0.0072 seconds on a G2 Prime. Although it's a CAS function, it also seems to work in Home and in non-CAS programs. No idea. The randseed() function doesn't seem to have any effect on the output of rand(X,Y,Z). Perhaps Bernard Parisse, who created Prime's CAS, can give us the details of how rand(X,Y,Z) works. <0|ΙΈ|0> -Joe- |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)