It is the first method proposed by Knuth in The Art of Computer Programming volume 2 also the first method in Numerical Recipes in C and in many other resources (e.g., and ).ĭespite its pervasiveness, that method has flaws, some of them well known, some less so or overlooked. Besides, software offering the most methods to compute random integers will almost always provide only one means to obtain random floats, namely through the division of some random integer by another integer. Such information will have to be gathered directly from the source code when it is available. Take a look at your favorite software package documentation: chances are that it will describe the algorithm -or algorithms, since many provide more than one method- used to draw integers at random on the other hand, it will often fail to give any precise information regarding the way it obtains random floats. In his oft-quoted 1951 paper , John von Neumann asserts that “ f one wants to get random real numbers on (0, 1) satisfying a uniform distribution, it is clearly sufficient to juxtapose enough random binary digits.” That dismissive opinion seems to have been so largely shared to this day that the implementation of methods to compute random floating-point numbers (or floats, for short) almost always feels like an afterthought, even in respected numerical software and programming languages.
0 Comments
Leave a Reply. |