com.thortech.data.edn.generators documentation
An extension of clojure.data.generators... TODO
any-hierarchy
(any-hierarchy max-depth length-sizer gen-coll gen-item)
Generate a nested collection of items, where each item
is generated by gen-item. Shallower nestings are much
more likely.
any-keyword
(any-keyword)
Generates either an unqualified or fully-namespace-qualified keyword
any-symbol
(any-symbol)
Generates either an unqualified or fully-namespace-qualified symbol
call-through
(call-through x)
Recursively call x until it doesn't return a function.
date
(date)
Generates a random clojure date
edn-whitespace-str
(edn-whitespace-str)(edn-whitespace-str sizer)
Generates a string of edn whitespace
float
(float)
Returns a random float, excluding the NaN and infinities,
which are not yet edn readable
hierarchy
(hierarchy max-depth length-sizer gen-coll gen-item)
Generate a nested collection of items, where each item
is generated by gen-item.
is-valid-edn-double?
(is-valid-edn-double? n)
Checks if double argument is a valid edn double
mixed-collection
(mixed-collection child-fn)(mixed-collection child-fn coll-sizer)
Generates a collection of size coll-sizer with children generated by child-fn
normal
(normal mean)
Quick and dirty normal distribution around a mean
based on java.util.Randon nextGaussian
ns-keyword
(ns-keyword)
Generates a fully-namespace-qualified keyword
ns-str
(ns-str)(ns-str partitions-sizer part-length-sizer)
Returns a string to be passed to core/symbol as the namespace.
Number of partitions of namespace is determined partitions-sizer,
length of the parts are determined by part-length-sizer
ns-symbol
(ns-symbol)(ns-symbol ns-partitions-sizer)(ns-symbol ns-partitions-sizer part-length-sizer)
Generates a fully qualified symbol. Number of partitions determined
by ns-partiions-sizer length of parts determined by part-length-sizer
number
(number)
Generates a random number (int, long, float, double)
occasional
(occasional generator gen-prob nil-prob)
Produces a generator which either returns the result of the generator passed
as an argument or nil, depending on the relative probabilities (integers)
rescaled-geometric
(rescaled-geometric n)
Returns a sizer with geometric distribution around n
scalar
(scalar)
Returns a random scalar.
small-symbol
(small-symbol)
Generates a symbol from 1 to 32 characters long
tag-keyword
(tag-keyword)
Generates a keyword that can be used as a tag
tag-prefix
(tag-prefix)
Generates a random alphabetic character
uuid
(uuid)
Generates a random UUID
weighted-whitespace-str
(weighted-whitespace-str)(weighted-whitespace-str sizer)
Generates a string of whitespace, opinionatedly weighted
at 20:5:1 :: space:newline:random-whitespaces
whitespace-str
(whitespace-str)(whitespace-str sizer)
Generates a string of only whitespace