https://github.com/berndbischl/mlr
Raw File
Tip revision: 3d7e0aa91936e82cf108aff3c46b19e3f953eefd authored by pat-s on 10 January 2020, 22:23:02 UTC
Bump version to 2.17.0.9000
Tip revision: 3d7e0aa
mutateBits.R
# Takes a bit string and flips its elements based on a given mutation rate.
#

mutateBits = function(x, rate = 1 / length(x)) {
  n = length(x)
  flip = rbinom(n, 1, rate)
  (x + flip) %% 2
}
back to top