# Adding a User Defined Distribution

Simulation Master Tutorials > Entering Random Variables in a Model > Adding a User Defined Distribution

A user defined distribution can be added to the model using the user distribution function. The user distribution is typed in the desired cell as shown below.

=RVUSERDIST(formula)

Where formula is the user defined distribution formula.

RVUSERDIST is a wrapper that is used by the software to identify random variables in the model. To record input variables, correlate inputs and color input cells the software scans the sheet containing the output cell and looks for cell formulas that begin with “RV”.

The formula must evaluate to a numeric value or an error will result.

### Example User Defined Distribution

Suppose a random number, U is generated on (0,1). If U < .25, the random variable assumes a value of 5.2. If U >= .25, the random variable assumes a value of 8.7. The random number, U will be generated using the uniform distribution function, RVUNIFORM(0,1).

To enter this in the model, use the following formula in the appropriate cell.

=RVUSERDIST(IF(RVUNIFORM(0,1)<.25, 5.2, 8.7))

### Combining Random Variables into One Input

RVUSERDIST can also be used to combine two or more random variables into one input. This can be done two ways. The first is by entering the random variable functions and their relationship directly inside RVUSERDIST. The second way is by referencing other cells containing RV functions.

The following is an example where we have two random variables, price which is normally distributed and sales volume for which we will use a triangular distribution. We want to combine them so that we treat revenue as an input so we can record its values during the simulation.

Direct entry method: =RVUSERDIST(RVNORMAL(10,1)*RVTRIANGULAR(100,125,175))

Referenced cell method: =RVUSERDIST(C3*D3) where price is in cell C3 and volume in D3