This function returns a 0 argument function that can be used as
a generator function in the random.params
argument of the
param.net
function.
Examples
# Define function with equal sampling probability
a <- param_random(1:5)
a()
#> [1] 1
# Define function with unequal sampling probability
b <- param_random(1:5, prob = c(0.1, 0.1, 0.1, 0.1, 0.6))
b()
#> [1] 5