Random Integers, No Repeats
|
08-09-2023, 02:41 AM
Post: #2
|
|||
|
|||
RE: Random Integers, No Repeats
(08-09-2023 02:30 AM)lrdheat Wrote: I cannot remember how to generate random numbers from x to y with no repeats…anybody know how to accomplish this using the RANDINT or randint command? You could create an array of y-x+1 elements, then generate a random integer in that range and if the corresponding element is 0, then it's a unique number. If so, append the number to a list and fill that element of the array with a non-zero. Once all the array is filled, you'll have your list. Tom L Cui bono? |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)