Basic Generators
Generators for some basic types
qc.bool
Generates a random boolean.
qc.byte
Generates a random integer between 0 and 255.
qc.constructor(constructorFn, argGens...)
Generates random objects by calling the constructor constructorFn
with random arguments using the generators supplied by argGens
function Animal(type, weight) {
this.type = type;
this.weight = weight;
}
var randomAnimal = qc.constructor(Animal, qc.pick('tiger', 'cow'), qc.natural);
class Animal
constructor: (@type, @weight) ->
randomAnimal = qc.constructor Animal, qc.pick('tiger', 'cow'), qc.natural
class Animal {
constructor(public type: string, public weight: number) {}
}
let randomAnimal: Animal = qc.constructor(Animal, qc.pick('tiger', 'cow'), qc.natural);
qc.fromFunction(function, argGens...)
Generates a random value by calling a function with random arguments.
Updated less than a minute ago