# Appendix A: Generating Random Numbers from a Distribution

### From ReliaWiki

Simulation involves generating random numbers that belong to a specific distribution. We will illustrate this methodology using the Weibull distribution.

# Generating Random Times from a Weibull Distribution

The *cdf* of the 2-parameter Weibull distribution is given by:

The Weibull reliability function is given by:

To generate a random time from a Weibull distribution, with a given and , a uniform random number from 0 to 1, , is first obtained. The random time from a weibull distribution is then obtained from:

## Conditional

The Weibull conditional reliability function is given by:

The random time would be the solution for for .

# BlockSim's Random Number Generator (RNG)

Internally, ReliaSoft's BlockSim uses an algorithm based on L'Ecuyer's [RefX] random number generator with a post Bays-Durham shuffle. The RNG's period is approximately 10^18. The RNG passes all currently known statistical tests, within the limits the machine's precision, and for a number of calls (simulation runs) less than the period. If no seed is provided the algorithm uses the machines clock to initialize the RNG.

# References

- L'Ecuyer, P., 1988, Communications of the ACM, vol. 31, pp.724-774
- L'Ecuyer, P., 2001, Proceedings of the 2001 Winter Simulation Conference, pp.95-105
- William H., Teukolsky, Saul A., Vetterling, William T., Flannery, Brian R., Numerical Recipes in C: The Art of Scientific Computing, Second Edition, Cambridge University Press, 1988.
- Peters, Edgar E., Fractal Market Analysis: Applying Chaos Theory to Investment & Economics, John Wiley & Sons, 1994.
- Knuth, Donald E., The Art of Computer Programming: Volume 2 - Seminumerical Algorithms, Third Edition, Addison-Wesley, 1998.