MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / randomInt

Function randomInt

assets/js/block_ninja.js:227–227  ·  view source on GitHub ↗
(min, max)

Source from the content-addressed store, hash-verified

225
226// Generates a random integer between and possibly including min and max values
227const randomInt = (min, max) => ((Math.random() * (max - min + 1)) | 0) + min;
228
229// Returns a random element from an array
230const pickOne = arr => arr[Math.random() * arr.length | 0];

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected