Drawing Random Floating-point Numbers from an Interval

被引:2
|
作者
Goualard, Frederic [1 ,2 ]
机构
[1] CNRS, LS2N, UMR 6004, Nantes, France
[2] Univ Nantes, LS2N, CNRS, UMR 6004, 2 Rue Houssiniere,BP 92208, F-44322 Nantes 3, France
关键词
Floating-point number; IEEE; 754; standard; random float;
D O I
10.1145/3503512
中图分类号
TP39 [计算机的应用];
学科分类号
081203 ; 0835 ;
摘要
Drawing a floating-point number uniformly at random from an interval [a, b) is usually performed by a location-scale transformation of some floating-point number drawn uniformly from [0, 1). Due to the weak properties of floating-point arithmetic, such a transformation cannot ensure respect of the bounds, uniformity or spatial equidistributivity. We investigate and quantify precisely these shortcomings while reviewing the actual implementations of the method in major programming languages and libraries, and we propose a simple algorithm to avoid these shortcomings without compromising performances.
引用
收藏
页数:24
相关论文
共 50 条