Based on user input seeds, this function generates a vector of n pseudo-random numbers by calling mlsjunkgenv which in turn calls junkgen.

mlsjunkgenm(nrow = 1, ncol = 1, w, x, y, z, round = 5)

Arguments

nrow

the number of rows for the matrix; defaults to 1

ncol

the number of columns for the matrix; defaults to 1

w

the first seed required by the MLS Junk Generator algorithm

x

the first seed required by the MLS Junk Generator algorithm

y

the first seed required by the MLS Junk Generator algorithm

z

the first seed required by the MLS Junk Generator algorithm

round

the number of decimal places to which to round the pseudo-random numbers; default = 5

Value

A numeric vector containing a single pseudo-random number

Examples

# Generate a 4x4 matrix of pseudo-random numbers with user-specified seeds w <- 1 x <- 2 y <- 3 z <- 4 mlsjunkgenm(nrow = 4, ncol = 4, w = w, x = x, y = y, z = z) # returns a 4x4 matrix
#> [,1] [,2] [,3] [,4] #> [1,] 0.95516 0.11995 0.33525 0.91985 #> [2,] 0.66908 0.56398 0.70271 0.37872 #> [3,] 0.21235 0.59235 0.41810 0.28042 #> [4,] 0.34488 0.11432 0.31337 0.05181
# the sixteen values in the above matrix are equivalent to the following call # to mlsjunkgenv mlsjunkgenv(n = 16, w = w, x = x, y = y, z = z)
#> [1] 0.95516 0.66908 0.21235 0.34488 0.11995 0.56398 0.59235 0.11432 0.33525 #> [10] 0.70271 0.41810 0.31337 0.91985 0.37872 0.28042 0.05181
# matrices need not be square # this returns a 3x2 matrix of pseudo-random numbers with 2 decimal places mlsjunkgenm(nrow = 3, ncol = 2, w = w, x = x, y = y, z = z, round = 2)
#> [,1] [,2] #> [1,] 0.96 0.34 #> [2,] 0.67 0.12 #> [3,] 0.21 0.56
# using the default value of n (1) generates a 1x1 matrix the value of which # is identical to running junkgen and rounding the result to 5 decimal places round(junkgen(w = w, x = x, y = y, z = z), 5) # returns "[1] 0.95516"
#> [1] 0.95516
mlsjunkgenv(w = w, x = x, y = y, z = z) # returns a 1x1 matrix with single element = "0.95516"
#> [1] 0.95516