This repository was archived by the owner on Nov 22, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +3
-109
lines changed Expand file tree Collapse file tree 3 files changed +3
-109
lines changed Original file line number Diff line number Diff line change 19
19
"es6-promise" : " ^4.1.0" ,
20
20
"file-saver" : " ^1.3.3" ,
21
21
"lodash" : " ^4.14.1" ,
22
+ "seedrandom" : " ^2.4.3" ,
22
23
"whatwg-fetch" : " ^2.0.3"
23
24
},
24
25
"devDependencies" : {
Original file line number Diff line number Diff line change 1
1
import { clamp } from 'lodash'
2
- import { impl } from '../vendor/alea '
2
+ import { alea } from 'seedrandom '
3
3
4
4
// Random uuid4 generation
5
5
export const uuid4 = ( random = Math . random ) =>
@@ -16,19 +16,8 @@ export const uuid4 = (random=Math.random) =>
16
16
export class Random {
17
17
constructor ( options = { } ) {
18
18
if ( options . algorithm === 'alea' ) {
19
- // If no seed is given, autoseed the PRNG using
20
- // a (mostly) random 256-character string
21
- // (This seeding mechanism is loosely based on
22
- // the priming mechanism in the seedrandom package
23
- // by David Bau, https://github.com/davidbau/seedrandom)
24
- if ( ! options . seed ) {
25
- // IE 11 uses a vendor prefix for the crypto module
26
- const randomValues = ( window . mscrypto || window . crypto )
27
- . getRandomValues ( new Uint8Array ( 256 ) )
28
- options . seed = String . fromCharCode ( ...randomValues )
29
- }
30
19
// Generate a PRNG using the alea algorithm
31
- this . random = impl ( options . seed )
20
+ this . random = alea ( options . seed )
32
21
} else {
33
22
// Fallback to the built-in random generator
34
23
this . random = Math . random
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments