en.javascript.info/1-js/4-data-structures/2-number/9-random-int-min-max/task.md
2016-03-06 00:59:16 +03:00

410 B

importance: 2


A random integer from min to max

Create a function randomInteger(min, max) that generates a random integer number from min to max including both min and max as possible values.

Any number from the interval min..max must appear with the same probability.

Examples of its work:

alert( random(1, 5) ); // 1
alert( random(1, 5) ); // 3
alert( random(1, 5) ); // 5