Casio calculator and Roll Two Dice in Random

08212020, 02:00 AM
(This post was last modified: 08212020 02:12 AM by Gamo.)
Post: #1




Casio calculator and Roll Two Dice in Random
If you don't have a pair of dice around but got a Casio calculator that have this
Random Integer range function like Casio fx991EX around you can use these calculator to simulate the thowing a pair of dice. Procedure: FIX 1 RanInt #(1, 6) + RanInt #(1, 6) ÷ 10 Keep pressing [=] 6.1, 3.6, 5.5, 3.1, 2.6......... Above display 6.1 mean first dice is 6 and second dice is 1 both add up to 7 Gamo 2020 

08212020, 11:53 AM
Post: #2




RE: Casio calculator and Roll Two Dice in Random
For calculator with only RAN#, we can still get an unbiased dice throws.
see Exact Discrete pseudoRandom Sampling thread Here, we assume RAN# have range 0.000 to 0.999, or 1000 possibilities, all equally likely. Method 1: treat each digits as a throw, but eliminate bad cases (outside 1 to 6) RAN#: 0.846 0.479 0.035 > dice throws = 4 6 4 3 5 // eliminated 4 throws out of 9 Method 2: same idea, but with base 1000, so we need to remove 1000 mod 6 = 4 cases. 1 + 6 RAN#, dice throw = integer part, invalid throws = fractional parts > 0.995 1 + 6 RAN#: 1.492 6.4 5.32 4.444 2.236 > dice throws = 1 6 5 4 2 // all valid throws 

08212020, 09:16 PM
Post: #3




RE: Casio calculator and Roll Two Dice in Random
The Prime has enough builtin functions, I suggest using RANDMAT:
Code:
Thibault  not collector but in love with the few HP models I own  Also musician : http://walruspark.co 

08222020, 01:25 AM
Post: #4




RE: Casio calculator and Roll Two Dice in Random
(08212020 11:53 AM)Albert Chan Wrote: Method 1: treat each digits as a throw, but eliminate bad cases (outside 1 to 6) I was curious, on average, how many RAN# do we need to get 2 valid dices ? Let p = probability of valid digits = 6/10 ; bad cases q = 1p = 4/10 Probability distrubution = (p+q)³ = p³ + 3p²q + 3pq² + q³ = 0.216 + 0.432 + 0.288 + 0.064 = 1 Let a = 0.216 + 0.432 = 0.648 // 2+ valid dice from RAN# Let b = 0.288 // 1 valid dice from RAN# Let c = 0.064 // 0 valid dice from RAN# Let R_{k} = probability of finally getting 2+ valid dices for kth RAN# R1 = a R2 = c·a + b·(1c) R3 = c²a + 2bc·(1c) R4 = c³a + 3bc²·(1c) ... Expected RAN#'s to get 2+ valid dices = [R1,R2,R3,R4, ...] • [1,2,3,4, ...] = a*(1 + 2c + 3c² + 4c³ + ...) + 2b*(1c)*(1*2/2 + 2*3/2*c + 3*4/2*c² + ...) = (a + 2b) / (1c)² // see thread, Cut the Cards ≈ 1.39711 This matched simulation result Code: function test(n) lua> test(1e7), test(1e7), test(1e7), test(1e7), test(1e7) 1.3970112 1.397293 1.3971118 1.3968499 1.3971645 

08222020, 07:20 AM
Post: #5




RE: Casio calculator and Roll Two Dice in Random
(08212020 09:16 PM)pinkman Wrote: The Prime has enough builtin functions, I suggest using RANDMAT: Only works correctly in Home. Returns some 7's in CAS. Strange. RANDINT(2,1,6) is simpler. Note that rand(2,1,6) in CAS seems the same at first glance, but the former allows repeats (pairs), whereas the latter does not (AKA selection without replacement). <0ɸ0> Joe 

08222020, 03:24 PM
Post: #6




RE: Casio calculator and Roll Two Dice in Random
(08222020 07:20 AM)Joe Horn Wrote: RANDINT(2,1,6) is simpler.Much better! The Prime functions catalog is like a maze. So I correct my sentence: not “enough” functions, but “too much” functions Quote:Note that rand(2,1,6) in CAS seems the same at first glance, but the former allows repeats (pairs), whereas the latter does not (AKA selection without replacement).Nice observation. rand(6,1,6) > all integers from 1 to 6 in random order. rand(10,1,6) > Error. Invalid dimension. Thibault  not collector but in love with the few HP models I own  Also musician : http://walruspark.co 

« Next Oldest  Next Newest »

User(s) browsing this thread: