Description Usage Arguments Details Value Examples
Random shift
1 | random_shift(x, position, seed, elements)
|
x |
string or matrix. |
position |
positions of elements to be replaced. |
seed |
seed state. |
elements |
vector corresponding to the alphabet from which the replacement elements are taken from. |
This function replaces one or more bits of a given string or rows of a given matrix with pseudorandom elements from an alphabet. If the alphabet is not specified in advance, the default binary alphabet, consisting of "0" and "1", will be used.
A string or matrix with pseudorandomly generated replacements of symbols or rows.
1 2 3 4 5 6 7 8 9 | ## Not run:
# For a string
x <- "hola amigo"
random_shift(x, c(2,4,6,8), 157)
# For a matrix
A <- matrix(seq(1:100), nrow = 10, ncol = 10, byrow = TRUE)
random_shift(A, c(1, 3), 56)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.