How to produce random integer numbers from 0 - 100 but by 10s only?

后端 未结 2 877
说谎
说谎 2021-01-21 18:33

Using R (maybe runif() or sample()? ), how can one produce a set of integer random values? Lets say 100 random values from 0 - 100, but the values shou

2条回答
  •  一整个雨季
    2021-01-21 19:02

    One could select numbers uniformly from 0...10 and then multiply by 10. Sample code:

    q <- 10*sample(seq(0,10), 1000, replace=TRUE)
    

提交回复
热议问题