Create matrix of random values with dimensions copied from an existing matrix

runif_same_dims(mat, min = 0, max = 1)

Arguments

mat

matrix

min

lower limit of the distribution. Must be finite.

max

upper limit of the distribution. Must be finite.

Value

a matrix

Examples

mat <- matrix(0, 3, 3) runif_same_dims(mat)
#> [,1] [,2] [,3] #> [1,] 0.66028435 0.7696748 0.3891828 #> [2,] 0.09602416 0.9907123 0.4611865 #> [3,] 0.76560016 0.9705209 0.3152418