19BII Program Question  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: 19BII Program Question (/thread106817.html) 
19BII Program Question  Hans van der Drift  01282007 Hello, I would like to ask for some help. I have some general knowledge of the solver and formulas but I am stumped on how (or if) to create a simple dice rolling equation. I am trying to create a solver function that will recreate the following.
NUM DICE? = D So if I needed to recreate the rolling of 48 dice and show how many results are 5 and 6 cumulatively. or 32 dice and how many results are 4, 5 and 6 cumulatively. I saw a post from a guy that has done the on a TI82. He used this formula. Quote:
ClrHome
0>X
Input ("Num Dice? ", D)
Input ("Hit Min? ", H)
For (I,1,D,1)
If ((int (rand*6+1)>=H)
X+1>X
END
Disp X Quote: Re: 19BII Program Question  Marcus von Cube, Germany  01292007 This is a bit tricky but should work: HITS=SUM(I:1:DICE:1:MAX(0:SGN(INT(6xRAN#)+2HMIN)))Replace SUM by the summation sign (Sigma)
INT(6xRAN#) returns an integer from 0 to 5The summation sums up the ones that indicate a hit. Re: 19BII Program Question  Marcus von Cube, Germany  01292007 I just found out about the IF function:
HITS=SUM(I:1:DICE:1:IF(INT(6xRAN#)+1<HMIN:0:1))I didn't enter this version into my calc but it should work the same way and is easier to read. Re: 19BII Program Question  Hans van der Drift  01292007 Hi, Yes that works great. I appreciate your help.
Hans
