## create a unuran object for half-normal distribution using methed 'PINV'
gen <- pinv.new(dnorm,lb=0,ub=Inf)
## status of object
unuran.packed(gen)
## draw a random sample of size 10
x <- ur(gen,10)
## pack unuran object
unuran.packed(gen) <- TRUE
unuran.packed(gen)
## draw a random sample of size 10
x <- ur(gen,10)
if (FALSE) {
## unpacking is not supported
unuran.packed(gen) <- FALSE ## results in error
}
Run the code above in your browser using DataLab