Array Generators
qc.arrayOf(generator, [options])
Generates an array consisting of values produces by the generator passed. So qc.arrayOf(qc.uint)
would produce something like [8, 34, 46]
.
The options argument is an object that can have these keys:
Key | Type | Description |
---|---|---|
| Number or Generator that produces a number | This will be the length of the generated array. For example, to have an array of 3 to 5 items, you could do |
| Boolean | If |
qc.array
Generate a random array of any random type.
qc.array.subsetOf(array, [options])
Generates a subset of the passed array
. By this we mean that for every element of the generated array, it will be a member of the passed array
. Furthermore the element will not appear in the result array more times that in the passed array
.
For example qc.array.subsetOf([1, 2])
will generate one of []
, [1]
, [2]
or [1, 2]
.
The options argument is an object that can have these keys:
Key | Type | Description |
---|---|---|
| Number or Generator that produces a number | This will be the length of the generated array. For example, to have an array of 3 to 5 items, you could do |
| Boolean | If |
Updated 19 days ago