Math.random() will give you a random floating point number from 0 to 1 (non-inclusive of 1) and so to convert that result into a whole number, you’ll need to implement some basic math.
In this video I show you a simple example of how to generate a random number and also how to generate a random whole number (or integer) between a range of 1 and X.
For your reference, check this out:
Support me on Patreon:
Follow me on Twitter @dcode!
If this video helped you out and you’d like to see more, make sure to leave a like and subscribe to dcode!
RAM as an Ultra Fast Hard Drive with Dataram RAMDiskJune 29, 2020 43