-4

I found some code snippets and I'm not sure what it means:

var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;

and

Math.floor(Math.random() * (max - min + 1)) + min

I'm still getting familiar with Javascript... could someone give me a reader's digest condensed version?

Pointy
  • 405,095
  • 59
  • 585
  • 614
Vanderbeam
  • 23
  • 3

1 Answers1

0

Math.floor() Round a number downward to its nearest integer

For example: if you have 2.7 it will round down to 2.

Math.random() Return a random number between 0 and 1

For example: .693

Adam Buchanan Smith
  • 9,422
  • 5
  • 19
  • 39