|
Currently, every Faker instance shares the same random number
generator instance which means that to seed one faker instance is to
seed them all. This can result in duplicate data being generated all
over the place.
This just extracts the public API of the mersenne twister found in
`vendor/mersenne.js` and creates a single instance of it per
faker.
This implementation is a tad sub-optimal since calling `seed()` on
a faker instance will result in two redundant calls to
`mersenne.init_genrand()`: one in `random.js` and the other in
`datatype.js`. It would probably be more DRY to create the mersenne
instance once in faker and then pass it into to the `Random` and
`Datatype` instances, however, this takes the strategy of the smallest
possible API change.
|