Post Reply 
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?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Random Integers, No Repeats - lrdheat - 08-09-2023, 02:30 AM
RE: Random Integers, No Repeats - toml_12953 - 08-09-2023 02:41 AM
RE: Random Integers, No Repeats - Joe Horn - 08-09-2023, 04:54 AM
RE: Random Integers, No Repeats - nickapos - 08-09-2023, 04:59 PM
RE: Random Integers, No Repeats - Joe Horn - 08-09-2023, 05:10 PM
RE: Random Integers, No Repeats - lrdheat - 08-09-2023, 01:24 PM
RE: Random Integers, No Repeats - Joe Horn - 08-09-2023, 05:31 PM
RE: Random Integers, No Repeats - nickapos - 08-09-2023, 06:04 PM
RE: Random Integers, No Repeats - parisse - 08-09-2023, 06:09 PM



User(s) browsing this thread: 1 Guest(s)