Skip to content

Commit

Permalink
Replace seed-random by seedrandom (#1955)
Browse files Browse the repository at this point in the history
  • Loading branch information
poppinlp authored Sep 6, 2020
1 parent 323de6b commit 943f1db
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"escape-latex": "^1.2.0",
"fraction.js": "^4.0.12",
"javascript-natural-sort": "^0.7.1",
"seed-random": "^2.2.0",
"seedrandom": "^3.0.5",
"tiny-emitter": "^2.1.0",
"typed-function": "^2.0.0"
},
Expand Down
10 changes: 2 additions & 8 deletions src/function/probability/util/seededRNG.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// create a random seed here to prevent an infinite loop from seed-random
// inside the factory. Reason is that math.random is defined as a getter/setter
// and seed-random generates a seed from the local entropy by reading every
// defined object including `math` itself. That means that whilst getting
// math.random, it tries to get math.random, etc... an infinite loop.
// See https://github.com/ForbesLindesay/seed-random/issues/6
import seedrandom from 'seed-random'
import seedrandom from 'seedrandom'

const singletonRandom = /* #__PURE__ */ seedrandom()
const singletonRandom = /* #__PURE__ */ seedrandom(Date.now())

export function createRng (randomSeed) {
let random
Expand Down
2 changes: 1 addition & 1 deletion test/node-tests/treeShaking/treeShaking.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('tree shaking', function () {
// this may grow or shrink in the future
assert.strictEqual(info.assets[0].name, bundleName)
const size = info.assets[0].size
const maxSize = 100000
const maxSize = 110000
assert(size < maxSize,
'bundled size must be small enough ' +
'(actual size: ' + size + ' bytes, max size: ' + maxSize + ' bytes)')
Expand Down

0 comments on commit 943f1db

Please sign in to comment.