1
$\begingroup$

I have been following the tutorial at Codecademy

I see that, as part of the process of creating a virtual die we multiply 'a random number between 0 and 1' by 6 to give us a random number between 0 and 6.

Could you break this logic down and explain why this works?

In short I am looking at this answer and asking for a nice simple explanation for why that works.

  • 0
    fyi - I have come accross a follow-up on the codecademy site that outlines the methodology in further detail and in a clear and simple manner: http://www.codecademy.com/courses/primitives-development-course/5?curriculum_id=4f4bdd96848740000300026a#!/exercises/0 (It is less assumptive but still does not try to prove it mathematically )2012-12-17

2 Answers 2