summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authortoasteater <48371905+toasteater@users.noreply.github.com>2019-03-18 11:41:16 +0800
committertoasteater <48371905+toasteater@users.noreply.github.com>2019-03-19 18:14:58 +0800
commit5f1b9a23132408160cf0b99e1e162413ab0e382b (patch)
tree631b214908b1af14f18872555d0cbe83886c9c43 /editor
parentdf7d3708c5b535c3696943322a14ec19a175e30c (diff)
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.
Diffstat (limited to 'editor')
0 files changed, 0 insertions, 0 deletions