openssl (version 0.2)

rand_num: Generate random numbers

Description

Simple wrapper for rand_bytes to generate random 32 bit doubles between 0 and 1. This is a somewhat more convenient and conventional interface to the RNG.

Usage

rand_num(n)

Arguments

n
how many random numbers to generate

Examples

Run this code
# Use CDF to map [0,1] into random draws from a distribution
x <- qnorm(rand_num(1000), mean=100, sd=15)
hist(x)

y <- qbinom(rand_num(1000), size=10, prob=0.3)
hist(y)

Run the code above in your browser using DataCamp Workspace