So I have this project to write that involves a random number generator. The program is a simple dice-rolling simulator, in which the seed is asked for, then the number of times you want it to roll dice. Then it should output the dice rolls, and give probability for each number. Here's what my teacher gave me notes for on probability:
P(1)=#'s of 1's rolled/total# rolls
P(2)=
P(3)=, etc.
We have just started programming and I have no idea what the hell I'm doing. Anything at this point would help a lot.
Name:
Anonymous2008-02-26 10:52
We have just started programming and I have no idea what the hell I'm doing.
Read SICP
Name:
Anonymous2008-02-26 11:01
>>1
Create a function that returns a random number between 1 and 6 inclusive - this will emulate your dice roll.
Create an array of six elements, and set them all to zero - these will be your counters for each roll result.
Roll the dice as many times as you need, and after each roll, increase the resultant number in the array by one.