53. Faker

The FAKER module implements collection of random data generators for use in testing and otherwise.

All functions and symbols are in “faker” module, use require to get access to it.

require daslib/faker

53.1. Type aliases

BitRepresentation64 is a variant type

ui2

uint[2]

d

double

i64

int64

u64

uint64

64-bit representation of a float

Faker

Faker fields are

min_year

uint

total_years

uint

rnd

iterator<uint>

max_long_string

uint

Instance of the faker with all the settings inside.

53.2. Constructor

Faker(rng: iterator<uint>)

Faker returns faker::Faker

argument

argument type

rng

iterator<uint>

Creates new instance of a Faker given a random number generator.

53.3. Random values

random_int(faker: Faker)

random_int returns int

argument

argument type

faker

faker::Faker

Generates random integer.

random_uint(faker: Faker)

random_uint returns uint

argument

argument type

faker

faker::Faker

Generates random unsigned integer.

random_int8(faker: Faker)

random_int8 returns int8

argument

argument type

faker

faker::Faker

Generates random int8.

random_uint8(faker: Faker)

random_uint8 returns uint8

argument

argument type

faker

faker::Faker

Generates random uint8.

random_int16(faker: Faker)

random_int16 returns int16

argument

argument type

faker

faker::Faker

Generates random int16.

random_uint16(faker: Faker)

random_uint16 returns uint16

argument

argument type

faker

faker::Faker

Generates random uint16.

random_float(faker: Faker)

random_float returns float

argument

argument type

faker

faker::Faker

Generates random float.

random_int2(faker: Faker)

random_int2 returns int2

argument

argument type

faker

faker::Faker

Generates random int2.

random_range(faker: Faker)

random_range returns range

argument

argument type

faker

faker::Faker

Generates random range.

random_range64(faker: Faker)

random_range64 returns range64

argument

argument type

faker

faker::Faker

Generates random range64.

random_int3(faker: Faker)

random_int3 returns int3

argument

argument type

faker

faker::Faker

Generates random int3.

random_int4(faker: Faker)

random_int4 returns int4

argument

argument type

faker

faker::Faker

Generates random int4.

random_uint2(faker: Faker)

random_uint2 returns uint2

argument

argument type

faker

faker::Faker

Generates random uint2.

random_urange(faker: Faker)

random_urange returns urange

argument

argument type

faker

faker::Faker

Generates random urange.

random_urange64(faker: Faker)

random_urange64 returns urange64

argument

argument type

faker

faker::Faker

Generates random urange64.

random_uint3(faker: Faker)

random_uint3 returns uint3

argument

argument type

faker

faker::Faker

Generates random uint3.

random_uint4(faker: Faker)

random_uint4 returns uint4

argument

argument type

faker

faker::Faker

Generates random uint4.

random_float2(faker: Faker)

random_float2 returns float2

argument

argument type

faker

faker::Faker

Generates random float2.

random_float3(faker: Faker)

random_float3 returns float3

argument

argument type

faker

faker::Faker

Generates random float3.

random_float4(faker: Faker)

random_float4 returns float4

argument

argument type

faker

faker::Faker

Generates random float4.

random_float3x3(faker: Faker)

random_float3x3 returns math::float3x3

argument

argument type

faker

faker::Faker

Generates random float3x3.

random_float3x4(faker: Faker)

random_float3x4 returns math::float3x4

argument

argument type

faker

faker::Faker

Generates random float3x4.

random_float4x4(faker: Faker)

random_float4x4 returns math::float4x4

argument

argument type

faker

faker::Faker

Generates random float4x4.

random_int64(faker: Faker)

random_int64 returns int64

argument

argument type

faker

faker::Faker

Generates random int64

random_uint64(faker: Faker)

random_uint64 returns uint64

argument

argument type

faker

faker::Faker

Generates random uint64

random_double(faker: Faker)

random_double returns double

argument

argument type

faker

faker::Faker

Generates random double.

53.4. Random strings

long_string(faker: Faker)

long_string returns string

argument

argument type

faker

faker::Faker

Generates a long string of random characters. The string is anywhere between 0 and faker.max_long_string characters long.

any_string(faker: Faker)

any_string returns string

argument

argument type

faker

faker::Faker

Generates a string of random characters. The string is anywhere between 0 and regex::re_gen_get_rep_limit() characters long.

any_file_name(faker: Faker)

any_file_name returns string

argument

argument type

faker

faker::Faker

Generates random file name.

any_set(faker: Faker)

any_set returns uint[8]

argument

argument type

faker

faker::Faker

Generates random set (uint[8])

any_char(faker: Faker)

any_char returns int

argument

argument type

faker

faker::Faker

Generates random char. (1 to 255 range)

number(faker: Faker)

number returns string

argument

argument type

faker

faker::Faker

Generates random number string.

positive_int(faker: Faker)

positive_int returns string

argument

argument type

faker

faker::Faker

Generates random positive integer string.

any_int(faker: Faker)

any_int returns string

argument

argument type

faker

faker::Faker

Generates random integer string.

any_hex(faker: Faker)

any_hex returns string

argument

argument type

faker

faker::Faker

Generates random integer hex string.

any_float(faker: Faker)

any_float returns string

argument

argument type

faker

faker::Faker

Generates random float string.

any_uint(faker: Faker)

any_uint returns string

argument

argument type

faker

faker::Faker

Generates random unsigned integer string.

53.5. Date and time

month(faker: Faker)

month returns string

argument

argument type

faker

faker::Faker

Generates random month string.

day(faker: Faker)

day returns string

argument

argument type

faker

faker::Faker

Generates random day string.

is_leap_year(year: uint const)

is_leap_year returns bool

argument

argument type

year

uint const

Returns true if year is leap year.

week_day(year: uint const; month: uint const; day: uint const)

week_day returns int

argument

argument type

year

uint const

month

uint const

day

uint const

Returns week day for given date. dayOfWeek for 1700/1/1 = 5, Friday partial sum of days betweem current date and 1700/1/1 leap year correction sum monthly and day offsets

week_day(year: int const; month: int const; day: int const)

week_day returns int

argument

argument type

year

int const

month

int const

day

int const

Returns week day for given date. dayOfWeek for 1700/1/1 = 5, Friday partial sum of days betweem current date and 1700/1/1 leap year correction sum monthly and day offsets

date(faker: Faker)

date returns string

argument

argument type

faker

faker::Faker

Generates random date string.