aboutsummaryrefslogtreecommitdiff
path: root/lib/random.js
AgeCommit message (Collapse)AuthorFilesLines
2022-01-14chore: remove ts-generated source filesShinigami921-377/+0
2022-01-11chore: format lib without locales (#66)Shinigami1-43/+115
2021-03-24Give each faker instance its own random number generatorCharles Lowell1-4/+2
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.
2021-03-22Linting fixes for `./lib`Marak1-81/+81
2021-03-19Fix index generationOleksandrYehorov1-1/+1
2021-03-18Improve faker.random.arrayElements performanceOleksandrYehorov1-6/+12
2021-03-09Update description of faker.random.objectElementTilo Westermann1-1/+1
2021-03-03Updates deprecation messageMarak1-5/+5
Fixes typo is jsdoc
2021-03-03Issue 1114: New datatype moduleLBuerstmayr1-59/+16
Current status: - moved number(), float(), hexaDecimal(), boolean(), uuid() from random to datatype - moved respective test from random.unit to datatype.unit - tests of moved methods in random now check if DeprecationWarning is printed and respective method in datatype module is called - adapted all lib files that use moved methods (mostly number) - adapted tests of respective files to spy on the correct method - adapted README in order to promote usage of method that logs a DeprecationWarning
2021-03-03WIP: issue-1114-datatypes-moduleLBuerstmayr1-10/+2
2021-02-11Merge pull request #1063 from DanielLipowicz/fix/incorrectVinNumberMarak1-19/+55
Fix issue 1062; Add new alpha and alphanumeric functionality
2020-12-01Implement issue 1062; Add random.aplha functionality to blacklist some ↵Daniel Lipowicz1-19/+55
characters
2020-10-04Check if seed is a number or array before seeding faker.randomLuiz Strobelt1-8/+7
2020-08-23Merge pull request #683 from blslade-neumont/dev-random-wordMarak1-2/+2
Ensure faker.random.word does not return more than one word
2018-10-28[api] Added vehicle module #555Marak1-0/+31
2018-10-23[api] [minor] Remove `this` reference #718 #376Marak1-2/+1
2018-10-20merge with masterTyler1-1/+24
2018-09-26Add mixed options shape to the documentationTomassito1-1/+1
From the documentation it is not clear what shape should the options object take.
2018-09-21[api] [minor] Don’t use `Object.assign`Marak1-5/+8
* Should fix tests for `faker.random.float` * Was causing older versions of Node to fail
2018-09-21[api] Add method `faker.random.float`Jimmy Cann1-0/+20
- Extends the `faker.random.number` float to automatically return a 0.01 precision float - First parameter is set as the precision value
2018-08-15Ensure faker.random.word does not return more than one wordBrandon Slade1-2/+2
2017-10-15add random.alpaha with testsTyler1-0/+31
2017-09-09Revert "Update Random to create a per-instance copy of the RNG"Marak1-15/+3
This reverts commit 8a33cf0e7a57f8fe766034706d0230802788d1ff.
2017-09-08Update Random to create a per-instance copy of the RNGChris Chambers1-3/+15
Before this change, it appeared that multiple, independent Faker instances were legal. But, when multiple instances were created, their shared random number generators would overwrite each others' states. After this change, each Random instance (and therefore each Faker instance) has its own copy of the random number generator, ensuring that calls to one Faker instance do not affect the stream of values generated by another.
2017-09-08[minor] Fix typo in code commentMarak1-1/+1
2017-09-08Merge pull request #366 from joonhocho/masterMarak1-0/+28
[api] Add `faker.random.arrayElements`
2017-06-19Generate a hexaDecimal stringGokulnath Reddy1-0/+19
2017-03-01Fix generation of float numbersIvan Goncharov1-1/+3
Fixes #401
2016-04-08add faker.random.arrayElementsJoon Ho Cho1-0/+28
2016-04-04alphaNumeric takes now count as a argumentKrzysztof Kaczor1-3/+13
2016-03-17Bitcoin supportashmothership1-0/+9
2016-03-03Install jsdoc and add doclet stubs for all methodsTobias Witt1-3/+55
Descriptions are taken from existing comments if available. The address module already has some new sample descriptions.
2016-02-15[api] Added `random.locale` method. Closes #274Marak1-0/+4
* Returns a random locale * May not work correctly in locale builds
2016-02-14[api] [minor] Move semver to System resource #304Marak1-9/+0
2016-02-14Added faker.random.semver.Justin McConnell1-0/+5
Conflicts: lib/random.js
2016-02-08Merge pull request #335 from john-kurkowski/patch-1Marak1-1/+2
[fix] random.uuid not using seeded number generator
2016-02-06[api] Improved random methodsMarak1-1/+58
* Adds `random.word` * Adds `random.words` * Adds `random.image` shortcut
2016-01-20Fix random.uuid not using seeded number generatorJohn Kurkowski1-1/+2
2015-07-15Implemented faker.seed method for randomization seedingBrandon Dail1-3/+11
2015-07-08[api] [refactor] Rename `array_element` and `object_element` to camelCase. ↵Marak1-35/+35
Set default max random number to 99999. Added default arguments to some methods.
2015-07-08[refactor] [major] Adds incremental browser builds. Switch to using ↵Marak1-67/+74
prototype for internal API. Previous usage of `module.parent` is not acceptable. Locale information is now passed into Faker constructor. Closes #125
2015-07-07[refactor] [dist] Allow for node to require individual locales ( to avoid ↵Marak1-1/+1
the default behavior of requiring all locale data. #125 #167
2015-06-11resolves #176 Add random boolean generatorAlan Shaw1-0/+4
2015-06-10Fixing bug in random.number when max = 0Phil Greenberg1-1/+1
Also added tests for random.array_element
2015-01-07Merge pull request #152 from jdrew1303/feature/uuid_generatorMarak1-0/+10
[api] Adds fake uuid generator
2014-12-22Added function to generate UUIDJames Drew1-0/+10
2014-12-16update documentation of array_elementAndreas Böhrnsen1-1/+1
2014-11-28added tests and corrected the number functionMichał Kawalec1-5/+4
2014-11-28precision changes precision and max doesn't modify options objectMichał Kawalec1-10/+13
2014-09-22[api] [minor] Added default values for more methods. Cleaned up image ↵Marak1-0/+1
module. Use a less specific regex for usernames.