3 ms·
The random floating-point numbers are not general-purpose, they are needed in applications whose input parameters are floating-point numbers. For instance they
by adrian_b 3y ago
The random floating-point numbers are not general-purpose, they are needed in applications whose input parameters are floating-point numbers.
For instance they are needed for testing the implementation of various functions of FP numbers, or for the so-called Monte-Carlo methods used for numerical integration, especially in multiple dimensions or for the solution of certain systems of equations with partial derivatives, or for the simulation of how some industrial product, e.g. an electronic integrated circuit, behaves when its components have random values of their characteristic parameters, within their accepted tolerances, as it always happens in any industrial production process, or the random numbers may be used in an optimization problem, to search through the possible solution space.
For random floating-point numbers it is frequent to need various other probability density distributions than uniform.
In most cases the best way to generate pseudo-random FP numbers is to derive them from uniform pseudo-random integers, using an appropriate method that will ensure the desired probability density distribution.