Problem 44951. Verify Law of Large Numbers
Solution Stats
Problem Comments

14 Comments
The solution quits because it's taking too long. 1e8 is too many?
The difference should essentially be zero i.e. the two averages equal. I wrote a successful script; run in my desktop environment but the tool won't accept my answer as valid.
It crashes every time, how to complete it?
To get this right apparently you have to generate the random numbers exactly the same way as the answer key. When it tests your script it seeds the random number generator and then confirms whether your program gets EXACTLY the same result. However, if you generate the random numbers in any way different from the key, your answer will be "wrong" but is probably still correct.
There is a MatLab function that does it. Nice and easy.
Nice one
"1e8 Nsided dice" made me confused. I think it should be changed to "1e8sided dice".
this problem brakes the website. 1e8 is too big and the website blocks out my computer.
After multiple tries of submitting what i thought the correct answer and being met with "While evaluating the solution, the server encountered an error caused by temporary unavailability of MATLAB Service. Wait a few minutes for the MATLAB Service to return, and then rescore." what seemed to do the trick was what Marcel Dornbusch hinted in his comment.
Just make sure you do not output every bit of information in the code, and just output the answer.
description of this problem is confusing.
Good problem
nice problem
description of this problem is confusing.
nice
Solution Comments

1 Comment
the question is confusing

1 Comment
please improve how the question is asked. It is unclear and takes a while to understand the question however, once understood the code to do it is easy

1 Comment
hard one

1 Comment
easy

1 Comment
I passed with a bullsh$t code

1 Comment
You roll Nsided dice 1e8 times. It takes a while for me to get this. Apart from it an easy question.

1 Comment
this one is fun!

1 Comment
It's really confusing, but: you have a dice with N sides! and you roll this dice 1e8 times!
Since I checkt this, the solution was clear ...

2 Comments
description of this problem is confusing.
that's right :(

1 Comment
Incorrect!
I created a "step by step" solution that was not accepted. Then I reformulated this solution for compound formula end, voila, it was accepted.

1 Comment
I don't know why every time I send the solution the site show me: "While evaluating the solution, the server encountered an error caused by temporary unavailability of MATLAB Service. Wait a few minutes for the MATLAB Service to return, and then rescore."

1 Comment
why tho

1 Comment
For saving execution time, do without outpout! Then it worked for me.

1 Comment
what is the problem with this solution

2 Comments
Note that using rand() with round() will not produce the correct answer. There is another function that must be used instead.
What can be used? I am a bit confused.

1 Comment
1e8 is too big for the Matlab website. It crashes every time I try it. I managed to find a solution on the full version so I put it in comments and cheated to pass it.

2 Comments
I discovered using a for loop doesn't work  too slow. Then I realised that randi can generate the required vector, doh!
Can anyone do that in a size smaller than 22? That was the smallest size I could get.
Problem Recent Solvers6187
Suggested Problems

It dseon't mettar waht oedrr the lrettes in a wrod are.
1025 Solvers

948 Solvers

1197 Solvers

Project Euler: Problem 3, Largest prime factor
896 Solvers

Sum of odd numbers in a matrix
398 Solvers
More from this Author13
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!