# Pre-compute random variable with same expected value and variance [closed]

Say I have an exponential distribution with parameter lambda λ. Is there a way to generate 100-500 pre-computed values that when summed, have the same variance and mean as the exponential (and the same distribution). How can I:

1. generate these values?
2. prove that they fit an exponential distribution?

One possible solution: generate the values to simulate maybe 10 million values and then group them into buckets somehow? Is there a good algorithm for this? I figure if this is done right, part 2 is not that necessary.

• Could you clarify what you mean by "when summed"? That phrase indicates you have a single value -- the sum -- which leaves us wondering what you're trying to accomplish.
– whuber
Dec 5, 2022 at 14:15

######################################
# PARAMETERS & INITIALIZATION        #

lambda <- 10
M <- 1000
set.seed(1)

######################################
# SIMULATION                         #

E <- rexp(1,lambda)   # one exponential random variable
U <- runif(M)         # M uniform random variables
X <- E * U / sum(U)   # M random variables satisfying the requirements

• can you add some annotations my good sir? Dec 5, 2022 at 5:28