(12C Platinum) Flip Virtual Coin - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (12C Platinum) Flip Virtual Coin (/thread-11969.html) |
(12C Platinum) Flip Virtual Coin - Gamo - 12-17-2018 07:09 AM This program allows you to flip a virtual coin by giving how many time you like to flip a coil then tell you how many time it was Head. ---------------------------------------- Procedure: FIX 0 with [ALG] Mode 1.Input Seed at Register 2 2. Input how many flips then [R/S] 3. Answer: number of Head 4. Continue STEP 2. ----------------------------------------- Example: Seed: .104056 [STO] 2 Number of flips: 10 [R/S] Result: 6 // With 10 flips it is 6 time with head result. ----------------------------------------- Program: ALG mode Code:
Remark: The computation speed depending on how large the number of flip. 12C Platinum App will run much faster. Gamo RE: (12C Platinum) Flip Virtual Coil - Dieter - 12-17-2018 09:01 AM (12-17-2018 07:09 AM)Gamo Wrote: This program allows you to flip a virtual coin by giving how many time you like to flip a coil then tell you how many time it was Head. The random number generator produces either a 0 or a 1. So you do not have to check whether this is zero or not... Code: ... ...instead you can simply add this 0 or 1 to register 1. ;-) Just replace the above code section with a simple STO+1. And change GTO 026 into GTO 023 of course. (12-17-2018 07:09 AM)Gamo Wrote: The computation speed depending on how large the number of flip. For a large number of n coin flips the head (and tail) count approaches n/2. So you may use the following program for very large n instead: Code: รท ;-) Dieter RE: (12C Platinum) Flip Virtual Coil - Gamo - 12-17-2018 10:39 AM Dieter Thanks for the review now changed using your recommendation. Gamo |