General
rand
Get a random item from array.
import { rand } from '@ngneat/falso';
rand([ 1, 2, 3 ])
rand([ 1, 2, 3 ], { length: 10 })
Live Editor
Result
Loading...
randAggregation
Generate a list of numbers that add up to a total value.
import { randAggregation } from '@ngneat/falso';
randAggregation() // default values is 2 and totalValue is 100
randAggregation({ values: 3, totalValue: 1500, length: 10 })
randAggregation({ values: 3 })
Live Editor
Result
Loading...
randBoolean
Generate a random boolean.
import { randBoolean } from '@ngneat/falso';
randBoolean()
randBoolean({ length: 10 })
Live Editor
Result
Loading...
randChanceBoolean
Generate a random chance boolean.
import { randChanceBoolean } from '@ngneat/falso';
randChanceBoolean({ chanceTrue: 0.78 }) // Will be true 78% of times
randChanceBoolean({ chanceFalse: 0.156 }) // Will be false 15.6% of times
randChanceBoolean({ length: 10 })
Live Editor
Result
Loading...
randFloat
Generate a random float.
import { randFloat } from '@ngneat/falso';
randFloat()
randFloat({ length: 10 })
randFloat({ min: 10, max: 20, fraction: 1 }) // 12.5
randFloat({ min: 10, max: 20, fraction: 2 }) // 12.52
Live Editor
Result
Loading...
randImg
Generate a random img.
import { randImg } from '@ngneat/falso';
randImg()
randImg({ length: 10 })
randImg({ width: 300 }) // default is "height" or 500 (if not set either)
randImg({ height: 200 }) // default is "width" or 500 (if not set either)
randImg({ grayscale: true }) // return a grayscale image (default is false)
randImg({ random: true }) // default is true, prevent the image from being cached
Live Editor
Result
Loading...
randNumber
Generate a random number.
import { randNumber } from '@ngneat/falso';
randNumber()
randNumber({ length: 10 })
randNumber({ min: 10, max: 1000 }) // default is 'min': 0, 'max': 999_999
randNumber({ min: 0.1, max: 1, fraction: 2 }) // 0.37
randNumber({ min: 1000, max: 100000, precision: 1000 }) // 67_000
randNumber({ min: 1000, max: 2000, precision: 100 }) // 1_200
randNumber({ min: 1000, max: 2000, precision: 10 }) // 1_250
Live Editor
Result
Loading...
randPriority
Generate a random priority.
import { randPriority } from '@ngneat/falso';
randPriority()
randPriority({ length: 10 })
Live Editor
Result
Loading...
randSequence
Generate a random sequence.
import { randSequence } from '@ngneat/falso';
randSequence()
randSequence({ size: 10 })
randSequence({ chars: 'aAbBcC@#' })
randSequence({ charType: 'numeric' }) // numeric | alpha | alphaNumeric | special
randSequence({ length: 10 })
Live Editor
Result
Loading...
randShape
Generate a random shape.
import { randShape } from '@ngneat/falso';
randShape()
randShape({ length: 10 })
Live Editor
Result
Loading...
randStatus
Generate a random status.
import { randStatus } from '@ngneat/falso';
randStatus()
randStatus({ type: 'User Story' })
randStatus({ length: 10 })
Live Editor
Result
Loading...
randSvg
Generate a random svg.
import { randSvg } from '@ngneat/falso';
randSvg()
randSvg({ length: 10 })
Live Editor
Result
Loading...
randUuid
Generate a random uuid.
import { randUuid } from '@ngneat/falso';
randUuid()
randUuid({ length: 10 })
Live Editor
Result
Loading...
random
Create a seed.
import { random } from '@ngneat/falso';
random()
Live Editor
Result
Loading...
seed
Sets and Resets random seed.
import { seed } from '@ngneat/falso';
seed()
seed('some-constant-seed')