Every line of 'mdn math.random' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
51 function random (n){ 52 if(typeof n === 'object'){ 53 var times = n[1]-n[0]; 54 var offset = n[0]; 55 return Math.random()*times + offset; 56 }else{ 57 return n; 58 } 59 }
78 public static random(): number { 79 return math.random(); 80 }
30 function rand( n ) { 31 return n * randu(); 32 }
648 static Random (n, m) { 649 return new Matrix.Zero(n, m).map( 650 function() { return Math.random(); } 651 ); 652 }
29 function randn(mu, std) { return mu + gaussRandom() * std; }
107 function randn(rng: () => number, mu: number, std: number) { 108 return mu + gaussRandom(rng) * std; 109 };
1 export function random(d, type) { 2 const a = new Array(d); 3 4 for (let i = 0; i < d; i++) { 5 a[i] = type(Math.floor(Math.random() * d)); 6 } 7 8 return a; 9 }
7 function generate_n(rng: RandomGenerator, num: number): [number[], RandomGenerator] { 8 let cur: RandomGenerator = rng; 9 const out: number[] = []; 10 for (let idx = 0 ; idx != num ; ++idx) { 11 const [value, next] = cur.next(); 12 out.push(value); 13 cur = next; 14 } 15 return [out, cur]; 16 }
218 export function randn(mu: number, std: number): number { 219 return mu + Util.gaussRandom() * std; 220 }
313 function pseudorandom(nMax) { 314 seed = (seed + 0.81282849124) * 2375.238208308; 315 seed -= Math.floor(seed); 316 317 return Math.floor(seed * nMax); 318 };