MCPcopy
hub / github.com/tensorflow/tfjs-examples / getRandomInteger

Function getRandomInteger

snake-dqn/utils.js:27–31  ·  view source on GitHub ↗
(min, max)

Source from the content-addressed store, hash-verified

25 * @return {number} The random integers.
26 */
27export function getRandomInteger(min, max) {
28 // Note that we don't reuse the implementation in the more generic
29 // `getRandomIntegers()` (plural) below, for performance optimization.
30 return Math.floor((max - min) * Math.random()) + min;
31}
32
33/**
34 * Generate a given number of random integers >= min and < max.

Callers 4

getRandomActionFunction · 0.90
initializeSnake_Method · 0.90
makeFruits_Method · 0.90
utils_test.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected