Below are examples of generating 5 random numbers using various probability distributions.
runif(5, min=0, max=10)
[1] 2.1724399 8.9209930 6.1969249 9.3303321 2.4054102
rnorm(5, mean=0, sd=1)
[1] -0.97414402 -0.85722281 -0.08555494 -0.37444299 1.20032409
rbinom(5, size=10, prob=0.5)
[1] 4 3 5 2 3
rgeom(5, prob=0.2)
[1] 14 8 11 1 3
rhyper(5, m=3, n=10, k=5)
[1] 2 0 1 1 1
rnbinom(5, size=10, prob=0.8)
[1] 3 1 3 4 2
rpois(5, lambda=2)
[1] 2 1 2 3 4
rexp(5, rate=1.5)
[1] 1.8993303 0.4799358 0.5578280 1.5630711 0.6228000
rlogis(5, location=0, scale=1)
[1] 0.9498992 -1.0287433 -0.4192311 0.7028510 -1.2095458
rchisq(5, df=15)
[1] 14.89209 19.36947 10.27745 19.48376 23.32898
rbeta(5, shape1=1, shape2=0.5)
[1] 0.1670306 0.5321586 0.9869520 0.9548993 0.9999737
rgamma(5, shape=3, scale=0.5)
[1] 2.2445984 0.7934152 3.2366673 2.2897537 0.8573059
rcauchy(5, location=0, scale=1)
[1] -0.01285116 -0.38918446 8.71016696 10.60293284 -0.68017185
rlnorm(5, meanlog=0, sdlog=1)
[1] 0.8725009 2.9433779 0.3329107 2.5976206 2.8171894
rweibull(5, shape=0.5, scale=1)
[1] 0.337599112 1.307774557 7.233985075 5.840429942 0.005751181
rwilcox(5, 10, 20)
[1] 111 88 93 100 124
rmultinom(5, size=5, prob=c(0.1,0.1,0.8))
[,1] [,2] [,3] [,4] [,5]
[1,] 0 0 1 1 0
[2,] 2 0 1 1 0
[3,] 3 5 3 3 5