Examples for 'stats::Exponential'


The Exponential Distribution

Aliases: Exponential dexp pexp qexp rexp

Keywords: distribution

### ** Examples

dexp(1) - exp(-1) #-> 0
[1] 0
## a fast way to generate *sorted*  U[0,1]  random numbers:
rsunif <- function(n) { n1 <- n+1
   cE <- cumsum(rexp(n1)); cE[seq_len(n)]/cE[n1] }
plot(rsunif(1000), ylim=0:1, pch=".")
abline(0,1/(1000+1), col=adjustcolor(1, 0.5))
plot of chunk example-stats-Exponential-1

[Package stats version 4.2.3 Index]