Skip to contents

Useful when testing developed model. We can check if the model accepts input arrays of the expected size and if it returns output with desired shape.

Usage

rand_array(...)

Arguments

...

Array dimensions.

Value

An array of random values between 0 and 1 with the defined dimensions.

Examples

rand_array(2,3,4)
#> , , 1
#> 
#>           [,1]      [,2]      [,3]
#> [1,] 0.2185972 0.6736555 0.2377239
#> [2,] 0.9887262 0.1960169 0.1888536
#> 
#> , , 2
#> 
#>           [,1]       [,2]      [,3]
#> [1,] 0.7025899 0.02459870 0.4355379
#> [2,] 0.9219437 0.05250765 0.7496297
#> 
#> , , 3
#> 
#>           [,1]      [,2]       [,3]
#> [1,] 0.8679635 0.9816918 0.04475075
#> [2,] 0.5870344 0.8737116 0.71748196
#> 
#> , , 4
#> 
#>           [,1]      [,2]      [,3]
#> [1,] 0.3455357 0.1864295 0.2961458
#> [2,] 0.4250036 0.2252871 0.5604467
#> 
dim(rand_array(32,14,8))
#> [1] 32 14  8