18 lines
No EOL
410 B
Markdown
18 lines
No EOL
410 B
Markdown
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:
|
|
|
|
```js
|
|
alert( random(1, 5) ); // 1
|
|
alert( random(1, 5) ); // 3
|
|
alert( random(1, 5) ); // 5
|
|
``` |