how to generate random numbers with sequence in R -


i need generate random numbers between 20 , 50 5 increments. example, numbers must 20, 25, 30, 25, 50, 45 etc. difference between numbers should 5.

i tried this:

x<-floor(runif(50,20,50)) 

this gives me number between 20 , 50. there easy way in r?

i think arun referring this:

set.seed(123) sample(seq(from = 20, = 50, = 5), size = 50, replace = true) #  [1] 30 45 30 50 50 20 35 50 35 35 50 35 40 40 20 50 25 20 30 50 50 40 40 50 40 # [26] 40 35 40 30 25 50 50 40 45 20 35 45 25 30 25 20 30 30 30 25 20 25 35 25 50 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -