Problem 174. Roll the Dice!
is the solution correct???
To clarify the problem statement, it would be good to specify the dice are fair.
I've done something like this on an arduino for one of my classes
The first test case for this problem is flat out statistically terrible! In fact, it is quite easy for that assertion to fail on a well defined set of uniform dice! So if you submitted a "valid" solution to this trivial problem, and it failed, then re-submit it. It may well succeed the second time you try, with no change to your function at all.
Use randi function instead of rand.
Rigorous testing of RNG's is a challenging topic. See e.g. https://en.wikipedia.org/wiki/Diehard_tests and https://en.wikipedia.org/wiki/TestU01 .
why can't use unidrnd(6)?
Anyone want to tell me the odds of correctly completing the problem, and then having the checker reject it? Because i have a screenshot of my solution being rejected. Tried exactly the same again and it passed.
@jiangming wang: Cody utilizes vanilla MATLAB (no toolboxes).
Someone please explain me the question
Đề khó hiểu thật !
I offered a solution that should be working (works okay in Matlab) but not here: round(rand()*5+1); - not the most optimum, but still provides the correct output, yet fails the test
can anyone help me why
x1 = 1 + (5)*rand(1,1);
x2 = 1 + (5)*rand(1,1);
It's very easy with function "randi"
Yes, it is better to use randi, instead on rand
rand generates random numbers and randi generates random integers
Solution CommentsShow comments
Problem Recent Solvers8328
Arrange Vector in descending order
More from this Author56
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!