Skip to main content

Module base

Module base 

Source
Expand description

Base utilities for Faker generators

Constants§

ALPHANUMERIC
Alphanumeric characters
DIGITS
Digits
HEX_LOWER
Hex digits lowercase
HEX_UPPER
Hex digits uppercase
LETTERS
All letters
L_LETTERS
Lowercase letters
U_LETTERS
Uppercase letters

Functions§

bothify
Replace both # and ? in the template
letterify
Replace ? with random letter
numerify
Replace # with random digit, ? with random letter By default, the first # is replaced with 1-9 (no leading zero)
parse
Parse a template with interpolations like “#{first_name} #{last_name}”
rand_in_range
Generate a random number in range [min, max]
sample
Sample a random element from a slice
sample_many
Sample multiple random elements from a slice (with replacement)