summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/random_seed.js
blob: 54a4d36b302ea1fd485424e020b4215bc6280004 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
 * Test that the seed _srand() returns can be used to reproduce the values _rand() returns.
 */
(function() {
"use strict";

const seed1 = _srand();
const values1 = [_rand(), _rand(), _rand()];

const seed2 = _srand(seed1);
const values2 = [_rand(), _rand(), _rand()];

assert.eq(seed1, seed2);
assert.eq(values1, values2);
})();