Random Integers Wish
04-09-2015, 01:44 AM
Post: #1
 lrdheat Senior Member Posts: 770 Joined: Feb 2014
Random Integers Wish
I would like to see an option offered that would allow a user to choose between a list of random integers and a list of random numbers without duplication...equivalent to the statistical exercise of choosing balls from an urn with replacement, and an option to choose without replacement.
04-09-2015, 02:13 AM
Post: #2
 Joe Horn Senior Member Posts: 1,890 Joined: Dec 2013
RE: Random Integers Wish
(04-09-2015 01:44 AM)lrdheat Wrote:  I would like to see an option offered that would allow a user to choose between a list of random integers and a list of random numbers without duplication...equivalent to the statistical exercise of choosing balls from an urn with replacement, and an option to choose without replacement.

Good news: What you seek is already available. In the following, all parameters are assumed to be integers.

RANDINT(n,a,b) --> n random integers between a and b inclusive, with possible duplicates.

rand(n,a,b) --> n random integers between a and b inclusive, with no duplicates. Of course, b-a must be big enough to accommodate n items, else an error occurs.

Notice that rand must be spelled in lowercase, whereas randint works in both uppercase and lowercase.

Alternative method: CAS.RANDOM(n,a,b) seems to be the same as rand(n,a,b), but CAS.RANDOM must be spelled all in uppercase.

<0|ΙΈ|0>
-Joe-
04-09-2015, 02:36 AM
Post: #3
 lrdheat Senior Member Posts: 770 Joined: Feb 2014
RE: Random Integers Wish
Thanks! I do remember noting this a long time ago, and forgot! This should be in the catalogue.
 « Next Oldest | Next Newest »

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