+ 1
Anyone tried to beat roulette game?
Im tring to make a code that could get some statistics out of example 10000 random numbers ranging from 0 to 36 any help?
8 Antworten
+ 11
"...10000 random numbers ranging from 0 to 36..."
// after declaring appropriate headers and seeding RNG
for (int i = 0; i < 10000; i++)
std::cout << rand() % 37 << " ";
// if you want to keep track of the number of hits on each number, use an array.
int arr[37];
for (int i = 0; i < 37; i++)
arr[i] = 0;
// now, for each hit, you want to increment the array element for the corresponding number by one.
// reusing the loop earlier
for (int i = 0; i < 10000; i++)
arr[rand() % 37] += 1;
// now you have recorded all the number of 0, 1, 2, ... 36s which has been hit.
// print them out.
for (int i = 0; i < 37; i++)
std::cout << arr[i] << " ";
+ 1
In what language
+ 1
c++
0
Well sorry, can't help ya there
0
you have something for roulette but in other languages?
0
i can code if you could just point out some ideas
0
Roll from 0 to 36 ten thousand times and keep the track of each number chosen. Then, rearrange them in ascending order, and count the percent chance of getting each of them by proportion
times chosen/all tries = chance/100
So you need to find a chance.
Do you want more?
0
well I have one in js, but you knda have to understand it