Repeat something 100 times

#1

Hi All - help please! How do I repeat the dice rolling (and recording results) in screen 2 of this activity 100 times with a single click?

https://teacher.desmos.com/activitybuilder/custom/5cc0f86aef2b0c5b7a6d293d

#2

Hello!

I do not think this is possible to achieve with a single click. I say this because the only way for it to automatically log the values is using “history” which creates a list from the “capture” sink. However, the capture sink only captures values when you click the button.

I tried to create a simulator that would run 100 trials in 10 seconds and attach it to the “timeSincePress” source. However, although it creates 100 trials… it cannot record them.

I could be wrong… either way here is the work I started.

#3

That’s correct if you are trying to generate the same number 100 times but it is possible to achieve the same result by generating 100 individual random numbers on button press. There are probably some fancy calculations you can do to achieve similar results with less random numbers but there’s a balance between performance and elegance there. Either way, 100 random numbers sounds like a beast.

#4

Thanks both PanettaMath and Jay - amazingly quick responses (as ever from this community!).

One trial here generates a random number for each of 4 dice and count how many 3’s you get on the 4 dice. Each student can repeat this 30 times and record their results in the table. I then use aggregate which, as a class, will give us an experiment with roughly 750 trials. The idea here is to demonstrate how experimental probability will approach theoretical probability with an ever larger number of trials.

Ideally then, I want to run the highest possible number of trials with a single click (limited I think by a maximum list length of 10,000). This sounds possible in theory, but generating what might actually by 40,000 random numbers does not sound efficient…?

More efficient would be to generate the 4 numbers, process them to count how many 3’s we got and repeat to keep a running count of how many times we got 0, 1, 2, 3 or 4 threes from the four dice.

Either way, I don’t really know how to do it!

Interested in any suggestions thanks…

#5

Hi Vince,

Thanks for that. I’ve been having a look at Chance Experiments • Activity Builder by Desmos.

Within the ‘game1graph3’ graph on screen 4 there’s some code which seems to stagger the start of each of 36 spinners using timeSincepress. It then processes and keeps a list to count how many times the player won out of 36.

It seems like it should help but I can’t quite figure it out!

Cheers!

#6

Hey Richard,

This activity is setup differently than the previous activity you shared. The author created 36 separate random number generators in the script. So it is just as Jay said, it would be possible to record 100 trials from a single button press if you copy and paste 100 different randomgenerators (1,6) and then capture the results.

If there is something you have already started, I wouldn’t mind taking a look.