Skip to contents

Randomly choose between generators

Usage

one_of(..., prob = NULL)

Arguments

...

A set of unnamed generators.

prob

A vector of probability weights for obtaining the elements of the vector being sampled.

Value

A quickcheck_generator object.

Examples

one_of(integer_(), character_()) %>% show_example()
#>  [1] -2425 -6980 -7116  8755 -2385 -6147 -4026 -3311   171  9779
one_of(constant(NULL), logical_(), prob = c(0.1, 0.9)) %>% show_example()
#> [1]  TRUE FALSE FALSE  TRUE FALSE FALSE  TRUE