Post Reply 
CAS vs. HOME
06-03-2014, 02:03 AM
Post: #1
CAS vs. HOME
I was making some lotto programs and was surprised to find that RANDOM behaves differently in HOME vs. CAS. Didn't find reference to this in the onboard help.

RANDINT (5,1,75) is the same in both HOME and CAS, producing 5 integers between 1 and 75 with duplicates of a number allowed.

With RANDOM, however, in HOME, one gets 5 numbers between 1 and 4.99999999999 while in CAS, you get 5 integers from 1 to 75 with no duplicates!

Why the different behavior?

In my program, CAS.RANDOM(5,1,75) is successful as it produces 5 integers with no duplicates from 1 to 75. Thus, I could avoid using RANDINT with it's potential duplicates by using a sort list command followed by a product list command which would then produce a 0 result that could be used to determine if a duplicate had occured, and the program could repeat new sets of numbers until I had a set with no duplicates...
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
CAS vs. HOME - lrdheat - 06-03-2014 02:03 AM
RE: CAS vs. HOME - Joe Horn - 06-03-2014, 03:18 AM



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