Accurate and Fast Modes of Random Number Generation
Using the distribution generators in the application, you can expect the obtained random numbers to belong to definitional domain of the corresponding distribution irrespective of its parameters. For example, random numbers xi obtained as output of the relevant generator that are uniformly distributed on [a, b) are assumed to satisfy the following condition: xi∈[a, b) for all indices i and for all values of a and b. However, because of the specificity of floating-point calculations and rounding modes, some continuous distribution generators may produce random numbers lying beyond definitional domain for some particular values of distribution parameters. This is not acceptable in applications for which accuracy of calculations is critical.
To resolve this issue, VS defines two modes of random number generation: accurate and fast. A generation mode is initialized during the call of the distribution generator by specifying value of the method parameter. For example, an accurate generation of single precision floating-point numbers from the distribution uniform on [a, b) interval in C looks as follows:
... status=vsRngUniform(VSL_METHOD_SUNIFORM_STD_ACCURATE, stream, n, r, a, b); ...
So, if a Monte Carlo application uses several distribution generators, each of them can be called in the preferable mode. When used in the accurate mode, the generators produce random numbers that belong to definitional domain for all parameter values of the distribution. The table below lists the generators that support the accurate mode of calculations:
|Type of Distribution||Data Types|
The distribution generators used in the fast mode produce numbers beyond the definitional domain in relatively rare cases. The application should set the accurate mode if all generated random numbers are expected to belong to the definitional domain irrespective of distribution parameter values. Use of the accurate mode may result in a slight performance degradation for random number generation.
Did you find the information on this page useful?