Test Data Functions
See also Generating Test Data.
Fake.address: A random one-line US address whose city and state belong together.
Fake(1).address() // 5666 Broad Trail, Bakersfield, CA 44960
Fake.chance: True with the given probability (0.0 to 1.0).
Fake(1).chance(0.5) // false
Fake.city: A random US city name.
Fake(1).city() // Irvine
Fake.company: A random company name.
Fake(1).company() // Vargas & Ryan
Fake.country: A random country name.
Fake(1).country() // South Africa
Fake.domain_name · Fake.domainName: A random domain name.
Fake(1).domain_name() // vasquezsalt.info
Fake.email: A random e-mail address at a reserved example domain (example.com, .org, .net); with a name, one made from that name.
Fake(1).email("Ada Lovelace") // ada.lovelace57@example.net
Fake.first_name · Fake.firstName: A random English given name.
Fake(1).first_name() // Victoria
Fake.float: A random float from 0.0 (included) to 1.0 (excluded), or from lo to hi.
Fake(1).float(0, 100) // 56.65615751722809
Fake.fork: An independent generator for a named stream of the same seed, unaffected by what was drawn before.
Fake(1).fork("people").first_name() // Mason
Fake.full_name · Fake.fullName: A random given name and surname.
Fake(1).full_name() // Victoria Vargas
Fake.int: A random integer from lo to hi, both included.
Fake(1).int(1, 6) // 4
Fake.job_title · Fake.jobTitle: A random job title such as Senior Data Analyst.
Fake(1).job_title() // Principal Infrastructure Officer
Fake.last_name · Fake.lastName: A random English surname.
Fake(1).last_name() // Vasquez
Fake.lorem: Lorem ipsum text of a random length from lo to hi bytes, in paragraphs, ending with a period.
Fake(1).lorem(100, 200).len() // 157
Fake.lorem_paragraph · Fake.loremParagraph: A random Lorem ipsum paragraph of 3 to 7 sentences.
Fake(1).lorem_paragraph().len() // 300
Fake.lorem_sentence · Fake.loremSentence: A random Lorem ipsum sentence of 6 to 14 words.
Fake(1).lorem_sentence() // Vel non non accumsan libero est consequat ac excepteur montes sunt.
Fake.phone: A random US phone number in the fictional 555-01xx range.
Fake(1).phone() // +1-648-555-0174
Fake.pick: A random element of a non-empty array.
Fake(1).pick(["red", "green", "blue"]) // green
Fake.sample: The given number of distinct elements of the array, in random order.
Fake(1).sample([1, 2, 3, 4], 2) // [3, 4]
Fake.seed: The seed the generator (or the root of a fork) was created with; pass it to Fake(seed) to reproduce a run.
Fake(1).seed() // 1
Fake.sentence: A random sentence of 4 to 12 words.
Fake(1).sentence() // Salt winter linen linen shadow swift mountain glacier snow.
Fake.shuffle: A copy of the array in random order.
Fake(1).shuffle([1, 2, 3, 4]) // [1, 2, 4, 3]
Fake.state: A random US state name.
Fake(1).state() // New Hampshire
Fake.state_abbr · Fake.stateAbbr: A random US state postal abbreviation.
Fake(1).state_abbr() // NH
Fake.street_address · Fake.streetAddress: A random house number and street name.
Fake(1).street_address() // 5666 Broad Trail
Fake.street_name · Fake.streetName: A random street name.
Fake(1).street_name() // Lakeview Circle
Fake.username: A random user name: a lowercase given name, an initial and a number.
Fake(1).username() // victoriav971
Fake.uuid: A random version 4 UUID value drawn from the seed.
Fake(1).uuid().as_string() // 910a2dec-8902-4cc1-beeb-8da1658eec67
Fake.word: A random English word.
Fake(1).word() // onyx
Fake.zip_code · Fake.zipCode: A random five-digit US ZIP code.
Fake(1).zip_code() // 57062