Techiio-author
Started by Natasha JonesSep 21, 2021

Open
Generating random whole numbers in JavaScript in a specific range?

1 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 1 VIEWES SHARE

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 Replies

Techiio-commentatorDavid Harrison replied 2 months ago0 likes0 dislikes

Hello miss, try this visibility

var randomnumber = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
You must be Logged in to reply
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance