/ Published in: JavaScript
Usage:
random_integer(1,100);
random_integer(1,100);
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* Receives the lowest and highest values of a range and returns a random integer that falls within that range. */ function random_integer(low, high) { return low + Math.floor(Math.random() * (high - low)); }