# Random Numbers

Sequences of random numbers are utilized in **SWedge**, in conjunction with the Sampling Method to generate random input data samples for a Probabilistic Analysis. The generation of random numbers in **SWedge** is controlled by the **Random Numbers** option in the Project Settings dialog.

- The Random Numbers option is only applicable if the Analysis Type = Probabilistic.
- If the Analysis Type = Deterministic or Combinations, then the Random Numbers option is not applicable and will have NO effect on the analysis results.

The Random Numbers options are described below.

## Random Number Generation

A sequence of random numbers is generated by specifying a "seed" value, and entering this seed value into a "random number generator". For a given seed value and a given random number generator, the SAME sequence of random numbers will always be generated. A different seed, or a different generator, will produce a different sequence of random numbers.

There are two options for specifying the seed value â€“ **Pseudo Random** or **Random**.

### PSEUDO-RANDOM (CONSTANT SEED VALUE)

**Pseudo-Random** sampling allows you to obtain reproducible results from a Probabilistic Analysis. If the Pseudo-Random option is selected, this means that the SAME "seed" number is always used to generate random numbers for the sampling of the input data distributions. This results in an identical sampling of the input data distributions, each time the analysis is run (with the same input parameters). The Probability of Failure, mean Safety Factor, and all other analysis output, will be reproducible. This can be useful for demonstration purposes, the discussion of example problems, etc.

By default, if the Pseudo Random option is selected, **SWedge** will always use the SAME "seed" value, to generate the same sequence of random numbers (this value is hard-coded into the program). However, the user may specify their own seed value by selecting the **Specify Seed** check box.

### PSEUDO-RANDOM + SPECIFY SEED (CONSTANT SEED VALUE)

The **Specify Seed** option simply allows the user to specify their own value of seed, rather than using the program's default seed value. To do this, select the **Specify Seed** check box, and enter any number.

If the user specifies their own seed, then the analysis will still be Pseudo Random (i.e. if you re-run the analysis, you will always get EXACTLY the same results). However, the results will NOT be the same as the results using the default seed value.

Each different value of seed will produce different results. However, for any given constant seed value, you will always get the same results (i.e. safety factor, probability of failure, and all other analysis results).

### RANDOM (VARIABLE SEED)

To simulate a true random analysis, you can select the **Random** option. If you select the Random option, **SWedge** will automatically generate a new seed value (based on the current time on your computer), each time you run an analysis.

This means that the analysis results will be different each time that you re-run the analysis. Different probabilistic input samples will be generated, and the Probability of Failure, mean Safety Factor, and all other analysis output, may vary with each run.

The Random option allows you to study the effect of re-running the analysis, using different random numbers (and therefore different input data) each time.

## How to Reproduce a Random Analysis

If you have run an analysis with the **Random** option, and you would like to be able to reproduce the results, then you must do the following:

- In the Info Viewer listing, the ACTUAL VALUE of the random number seed generated by
**SWedge**will be listed. - Copy this number from the Info Viewer listing.
- Select
**Pseudo Random**>**Specify Seed**in Project Settings, and enter the value of the random seed that you have copied from the Info Viewer. - If you re-run the analysis, you will find that you can reproduce the results that were generated by the Random option, as long as you use the Specify Seed option with the same seed value which was generated by the Random option.

## Random Number Generator

At the heart of the random number generation process, is a mathematical algorithm (the random number "generator"), which actually generates the sequences of random numbers. There are two random number generators available in **SWedge**.

**Park Miller v.3**

A minimal random number generator developed by Park and Miller (1983), which can generate an almost unlimited sequence of distinct random numbers (approximately 2 ^ 31).

**Rand**

Rand is a commonly used random number generator, which can generate a maximum of 32,768 distinct numbers.

Practically speaking, it will make little or no difference to the **SWedge** analysis results, which random number generator is chosen. Both methods generate uniformly distributed sequences of random numbers on the interval of 0 to 1. However, if a very large number of samples is being generated (for example, 10,000 or more), the user should be aware that the Rand generator will eventually start "repeating" the same values, and this may bias the results somewhat. In general, the Park Miller v.3 method is preferred, due to the nearly unlimited sequence of distinct random numbers which is generated.

Further information about random number generators and statistical distributions can be found in Saucier (2000).