Commit Graph

7 Commits

Author SHA1 Message Date
Rémi Verschelde 73960e585b
Merge pull request #27193 from toasteater/fix/pcg-randf
Improved uniformity of RandomPCG::randf.
2019-06-12 15:21:58 +02:00
Chaosus 6280be46a6 Properly setup seed in RNG 2019-03-27 19:37:25 +03:00
toasteater 5f1b9a2313 Improved uniformity of RandomPCG::randf.
When generating single precision floats, Godot casts a uint32_t to float,
causing uniformity loss.

This new randf, inspired by T. R. Campbell's random_real, samples the output
of rand as the fraction part of an infinite binary number, with some tricks
to reduce ops and branching. This method provides "good enough" uniformity at
decent speed, for floats greater than 2^-64. Smaller numbers are floored to 0.
2019-03-19 18:14:58 +08:00
Rémi Verschelde bce56cf337 Fix -Wc++11-extensions warning after #26737
Fixes #26769.
2019-03-07 22:48:00 +01:00
MidZik 4eccb58bc5 Fixed get_seed() not returning the correct seed. 2019-03-07 02:45:18 -06:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Chaosus f8151a9e50 Implement random number generator
Co-authored-by: Zirak <zirakertan@gmail.com>
2018-11-13 10:50:07 +03:00