Data generators for Clojure.
Data generators for Clojure.
Random instance for use in generators. By consistently using this instance you can get a repeatable basis for tests.
Random instance for use in generators. By consistently using this instance you can get a repeatable basis for tests.
(anything)
Returns a scalar or collection based on rnd.
Returns a scalar or collection based on *rnd*.
(boolean-array f)
(boolean-array f sizer)
Create an array with elements from f and sized from sizer.
Create an array with elements from f and sized from sizer.
(byte)
Returns a long based on rnd in the byte range.
Returns a long based on *rnd* in the byte range.
(byte-array f)
(byte-array f sizer)
Create an array with elements from f and sized from sizer.
Create an array with elements from f and sized from sizer.
(char)
Returns a character based on rnd in the range 0-65536.
Returns a character based on *rnd* in the range 0-65536.
(char-array f)
(char-array f sizer)
Create an array with elements from f and sized from sizer.
Create an array with elements from f and sized from sizer.
(collection)
Returns a collection of scalar elements based on rnd.
Returns a collection of scalar elements based on *rnd*.
(date)
(date base)
Create a date with geometric mean around base which defaults to #inst "2007-10-16T00:00:00.000-00:00"
Create a date with geometric mean around base which defaults to #inst "2007-10-16T00:00:00.000-00:00"
(default-sizer)
Default sizer used to run tests. If you want a specific distribution, create your own and pass it to a fn that wants a sizer.
Default sizer used to run tests. If you want a specific distribution, create your own and pass it to a fn that wants a sizer.
(double)
Generate a double between 0 and 1 based on rnd.
Generate a double between 0 and 1 based on *rnd*.
(double-array f)
(double-array f sizer)
Create an array with elements from f and sized from sizer.
Create an array with elements from f and sized from sizer.
(float)
Generate a float between 0 and 1 based on rnd
Generate a float between 0 and 1 based on *rnd*
(float-array f)
(float-array f sizer)
Create an array with elements from f and sized from sizer.
Create an array with elements from f and sized from sizer.
(geometric p)
Geometric distribution with mean 1/p.
Geometric distribution with mean 1/p.
(hash-map fk fv)
(hash-map fk fv sizer)
Create a hash-map with keys from fk, vals from fv, and sized from sizer.
Create a hash-map with keys from fk, vals from fv, and sized from sizer.
(int)
Returns a int based on rnd in the int range.
Returns a int based on *rnd* in the int range.
(int-array f)
(int-array f sizer)
Create an array with elements from f and sized from sizer.
Create an array with elements from f and sized from sizer.
(keyword)
(keyword sizer)
Create a non-namespaced keyword sized from sizer.
Create a non-namespaced keyword sized from sizer.
(list f)
(list f sizer)
Create a list with elements from f and sized from sizer.
Create a list with elements from f and sized from sizer.
Returns a long based on rnd. Same as uniform.
Returns a long based on *rnd*. Same as uniform.
(long-array f)
(long-array f sizer)
Create an array with elements from f and sized from sizer.
Create an array with elements from f and sized from sizer.
(one-of & specs)
Generates one of the specs passed in, with equal probability.
Generates one of the specs passed in, with equal probability.
(printable-ascii-char)
Returns a char based on rnd in the printable ascii range.
Returns a char based on *rnd* in the printable ascii range.
(rand-nth coll)
Replacement of core/rand-nth that allows control of the randomization basis (through binding rnd).
Replacement of core/rand-nth that allows control of the randomization basis (through binding *rnd*).
(ratio)
(ratio num-gen denom-gen)
Generate a ratio, with numerator and denominator uniform longs or as specified
Generate a ratio, with numerator and denominator uniform longs or as specified
(reps sizer f)
Returns sizer repetitions of f (or (f) if f is a fn).
Returns sizer repetitions of f (or (f) if f is a fn).
(reservoir-sample ct coll)
Reservoir sample ct items from coll, using rnd.
Reservoir sample ct items from coll, using *rnd*.
(scalar)
Returns a scalar based on rnd.
Returns a scalar based on *rnd*.
(set f)
(set f sizer)
Create a set with elements from f and sized from sizer.
Create a set with elements from f and sized from sizer.
(short)
Returns a short based on rnd in the short range.
Returns a short based on *rnd* in the short range.
(short-array f)
(short-array f sizer)
Create an array with elements from f and sized from sizer.
Create an array with elements from f and sized from sizer.
(string)
(string f)
(string f sizer)
Create a string with chars from f and sized from sizer.
Create a string with chars from f and sized from sizer.
(symbol)
(symbol sizer)
Create a non-namespaced symbol sized from sizer.
Create a non-namespaced symbol sized from sizer.
(tuple & generators)
Generate a tuple with one element from each generator.
Generate a tuple with one element from each generator.
(uniform)
(uniform lo hi)
Uniform distribution from lo (inclusive) to hi (exclusive). Defaults to range of Java long.
Uniform distribution from lo (inclusive) to hi (exclusive). Defaults to range of Java long.
(uuid)
Create a UUID based on uniform distribution of low and high parts.
Create a UUID based on uniform distribution of low and high parts.
(vec f)
(vec f sizer)
Create a vec with elements from f and sized from sizer.
Create a vec with elements from f and sized from sizer.
(weighted m)
Given a map of generators and weights, return a value from one of the generators, selecting generator based on weights.
Given a map of generators and weights, return a value from one of the generators, selecting generator based on weights.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close