R/take1.R

take1 = function(len) {
  out = c()
  i = 0
  while (i < len){
    out = c(out, i+sample(1:2))
    i = i+2
  }
  out = out[1:len]
  out[seq(1, len, 2)]
}

Try the horserule package in your browser

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

horserule documentation built on May 2, 2019, 10:04 a.m.