R/generatelens.r

generatelens <- function(maxLen, minLen, stdevLen, nString, distLen){
  if(distLen == 'normal'){
    medLen <- (maxLen+minLen)/2
    len <- rtruncnorm(n = nString, a = minLen, b = maxLen, mean = medLen, sd = stdevLen)
    len <- round(x = len)
  }
  else if(distLen == 'uniform'){
    len <- sample(minLen:maxLen, nString, replace = TRUE)
  }
  else{
    len <- "err in generatelens"
  }
  len
}

Try the randstr package in your browser

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

randstr documentation built on May 2, 2019, 3:09 p.m.