0 votes
1 view
in Web Technology by (47.8k points)

How can I generate random whole numbers between two specified variables in JavaScript, e.g. x = 4 and y = 8 would output any of 4, 5, 6, 7, 8?

1 Answer

0 votes
by (107k points)

If you want to generate random whole numbers in JavaScript in a specific range then you can use the below-mentioned code:-

var randomnumber = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...