Skip to content

Commit f5663d3

Browse files
🍏
1 parent 6a8809c commit f5663d3

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

readme.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -90,26 +90,27 @@ You can change the underlying PRNG or its seed as follows:
9090
```ts
9191
// change the underlying pseudo random number generator seed.
9292
// 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`).
9494
random.use('my-seed')
9595

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
9797
const rng = random.clone('my-new-seed')
9898

99-
// create a second independent random number generator using a custom PRNG
99+
// create a third independent random number generator using a custom PRNG
100100
import seedrandom from 'seedrandom'
101-
const rng2 = random.clone(seedrandom('kittyfoo'))
101+
const rng2 = random.clone(seedrandom('kitty-seed'))
102102
```
103103

104104
You can also instantiate a fresh instance of `Random`:
105105

106106
```ts
107107
import { Random } from 'random'
108-
import seedrandom from 'seedrandom'
109108

110109
const rng = new Random() // (uses Math.random)
111110
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+
})
113114
```
114115

115116
## API <!-- omit in toc -->

0 commit comments

Comments
 (0)