Skip to content

Commit

Permalink
🍀
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Sep 4, 2024
1 parent e2baf52 commit 704bac0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 31 deletions.
62 changes: 31 additions & 31 deletions src/__snapshots__/seed.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,37 @@ exports[`random.clone with seedrandom rng is consistent 1`] = `

exports[`random.clone with string seed is consistent 1`] = `
[
1.0605080478180011,
0.3824102148617453,
-0.7366504345478391,
-0.7946475045739224,
-1.2247324314330592,
0.6716850060654046,
-1.009299614178395,
0.053268550981502426,
0.9740577508148593,
-0.6752585320928494,
0.7446218073301792,
-2.129054359211667,
-1.8318170942537888,
0.12094888734754691,
-0.10445788111868438,
-0.08857052877829866,
-1.2097296776821065,
-0.117177897638088,
0.589262412952502,
-0.31461503408417685,
1.5492120933673714,
-0.30159579028234024,
0.10169022209103494,
-1.1878904212756178,
-0.4045334642187247,
-1.7727229412321357,
-2.1370757665469235,
2.552039624962811,
0.116684628880318,
-0.0738586836791935,
-0.7462649962349035,
-0.7308953270140024,
-1.397496377452742,
1.080022871482886,
Expand Down Expand Up @@ -176,36 +207,5 @@ exports[`random.clone with string seed is consistent 1`] = `
-0.42212246077683613,
0.4452340452580614,
0.5214098824451193,
0.5261731542250729,
-1.9760762141173631,
-0.02366443885152299,
2.2045706549604085,
-0.9539523110709375,
1.4506343286311132,
0.3467276605267618,
-0.3126486856331966,
0.3976234946199155,
0.03972873764115353,
-1.065135894710488,
-1.774696580571943,
-0.21789527191022195,
-0.40131086017803463,
1.1505442166993554,
-0.12989443662862746,
-0.5339995460989937,
-1.3689553822596103,
0.3658151914606086,
-0.31427810970979253,
0.09341633767524923,
-0.42638571686137094,
-0.4746635808010573,
0.6136865921177203,
0.013465964925832692,
2.0006709113661008,
-1.1190668236020196,
0.37543611825618245,
0.4693145026760069,
-0.19901649066247049,
-0.067766300521877,
]
`;
7 changes: 7 additions & 0 deletions src/distributions/uniform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ test('random.uniform() with seedrandom has mean 0.5', () => {
assert.closeTo(mean, 0.5, 0.05)
})

test('random.uniform() with seed has mean 0.5', () => {
const r = random.clone('OTU2YTM0NjQ5MjM1ZTA3MTg4YjQyYjUw')
const d = r.uniform()
const mean = calcMean(d)
assert.closeTo(mean, 0.5, 0.05)
})

test('random.uniform() with XOR128RNG has mean 0.5', () => {
const r = random.clone(new XOR128RNG(3))
const d = r.uniform()
Expand Down

0 comments on commit 704bac0

Please sign in to comment.