aboutsummaryrefslogtreecommitdiff
path: root/lib/mersenne.js
AgeCommit message (Collapse)AuthorFilesLines
2022-01-14chore: remove ts-generated source filesShinigami921-30/+0
2022-01-11chore: format lib without locales (#66)Shinigami1-15/+14
2021-03-24Give each faker instance its own random number generatorCharles Lowell1-0/+31
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.