R/swapmut.R

Defines functions swapmut

Documented in swapmut

# Swap mutation
swapmut = function(y, ...){
  n = length(y)
  v = sort(sample(1:n, size=2, replace=FALSE))
  takas = y[v[1]] 
  y[v[1]] = y[v[2]]
  y[v[2]] = takas
  return(list(mutant=y, mutgen=v))
}

Try the adana package in your browser

Any scripts or data that you put into this service are public.

adana documentation built on March 18, 2022, 6:03 p.m.