Generate Float // (0, 1)Math.random();// (0, max)Math.random() * max// (min, max)Math.random() * (max - min) + min Generate Int // (0, 1) no integer between 0 and 1// (0, max)parseInt(Math.random() * max); // include 0, but not include maxp
// (0, 1) Math.random(); // (0, max) Math.random() * max // (min, max) Math.random() * (max - min) + minGenerate Int
// (0, 1) no integer between 0 and 1 // (0, max) parseInt(Math.random() * max); // include 0, but not include max parseInt(Math.random() * (max + 1)); // include 0 and max // (min, max) parseInt(Math.random() * (max - min) + min); // include min, but not include max parseInt(Math.random() * (max - min + 1) + min); // include min and max