Basic HTML Version
Page 729 - ExtendSim User Guide
P. 729

``````Math and Statistical Distributions 703
Random numbers
Check Use include files in the block’s Equation tab
Click the Create New button
Give the new include file a name
In the window that appears, enter the procedure or function. For instance:
//**********************************
//START: Equation Include Prototypes
procedure myproc();//this will be displayed in the prototype list
//END: Equation Include Prototypes
//**********************************
procedure myproc()
{
userError("Hello World");
}
Use the procedure in the equation. In this case, when the equation is called the block will display a user error that says Hello World.
☞ If you have ExtendSim OR, ExtendSim AT, or ExtendSim Suite, see also the Equation Include File model; it is located at \Examples\Discrete Event\Tips.
Random numbers
The ability to include randomness and show dynamic aspects through time is one of the most valuable characteristics of a simulation experiment. Introducing randomness into a model mimics the patterns and unpredictability of the real world, increasing model accuracy. Since most models have randomness, it is important to understand random numbers.
ExtendSim has blocks, features, and functions that provide randomness in models. For exam- ple, the Random Number block (Value library) and the Create and Shutdown blocks (Item library) calculate random numbers using random distributions accessed through ModL func- tions. You can also specify random settings when using Sensitivity Analysis and for values in the ExtendSim database, and developers can directly access several random number functions.
Random number generators
The random functions produce random numbers based on a repeatable algorithm known as a pseudo random number generator. This generates the uniform random numbers used in the distribution functions. These 32-bit functions are seed-based and update their seed after being called. ExtendSim supports two types of random number generators:
• The recommended, default generator known as the minimal standard random number gener- ator initially by Lewis, Goodman, and Miller, using new coefficients by Gerald P. Dwyer, Jr. (See Numerical Recipes in C, 2nd edition, pp.279 “A portable and reasonably fast minimum standard random number generator that uses Schrage's algorithm” and L'Ecuyer - Comm. of the ACM, Oct. 1990, vol. 33 and L'Ecuyer and Cote, ACM Transactions on Mathematical Software, March 1991.)
• AnoptionalgeneratorbasedonSchrage,“AMorePortableFortranRandomNumberGener- ator,” ACM Transactions on Mathematical Software, Vol 5, No. 2, June 1979, pages 132- 138.
How To

``````
 727   728   729   730   731