@@ -90,26 +90,27 @@ You can change the underlying PRNG or its seed as follows:
90
90
``` ts
91
91
// change the underlying pseudo random number generator seed.
92
92
// by default, Math.random is used as the underlying PRNG, but it is not seedable,
93
- // so if a seed is given, we use an ARC4 PRNG.
93
+ // so if a seed is given, we use an ARC4 PRNG (the same one used by `seedrandom`) .
94
94
random .use (' my-seed' )
95
95
96
- // create a new independent random number generator (uses ARC4 under the hood)
96
+ // create a new independent random number generator with a different seed
97
97
const rng = random .clone (' my-new-seed' )
98
98
99
- // create a second independent random number generator using a custom PRNG
99
+ // create a third independent random number generator using a custom PRNG
100
100
import seedrandom from ' seedrandom'
101
- const rng2 = random .clone (seedrandom (' kittyfoo ' ))
101
+ const rng2 = random .clone (seedrandom (' kitty-seed ' ))
102
102
```
103
103
104
104
You can also instantiate a fresh instance of ` Random ` :
105
105
106
106
``` ts
107
107
import { Random } from ' random'
108
- import seedrandom from ' seedrandom'
109
108
110
109
const rng = new Random () // (uses Math.random)
111
110
const rng2 = new Random (' my-seed-string' )
112
- const rng3 = new Random (seedrandom (' my-seed-string' ))
111
+ const rng3 = new Random (() => {
112
+ /* custom PRNG */ return Math .random ()
113
+ })
113
114
```
114
115
115
116
## API <!-- omit in toc -->
0 commit comments