[Solved] Math.random() *100 verses Math.random(100) [closed]


Math.random() exists. Math.random(int) does not exist.

You may be getting that mixed up with the Random class constructor, which takes a long as a seed value, meaning your results will be pseudorandom and by consequence, repeatable.

If you wanted a number between 0 and 99 I actually would recommend that you use Random. You can leverage random.nextInt(100) to get a value between 0 and 99. Multiplying floats gets dicey very quickly, since Math.random() only produces a floating-point number.

solved Math.random() *100 verses Math.random(100) [closed]