3 ms·
I don't understand why you'd want a floating point random. It just seems like a terrible idea (as opposed to int)
by paulddraper 3y ago
I don't understand why you'd want a floating point random.
It just seems like a terrible idea (as opposed to int)
- fanf2 3y agoMany of the algorithms for generating random numbers from different distributions want to start with uniform floats in [0,1) or (0,1]
- adrian_b 3y agoThe 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.
- spacechild1 3y agoIn my field (music, video, games) random floating point numbers are ubiquitous.
- xigoi 3y agoThe uniform distribution of real numbers is easy to convert to other distributions, so if you want a language to have only one randomness function, it's a reasonable choice.
- extraduder_ire 3y agoThis is in javascript. All of the numbers are in floating point. (or were, initially)