summaryrefslogtreecommitdiffstats
path: root/core/math/random_pcg.h
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright statements to 2021Rémi Verschelde2021-01-011-2/+2
| | | | | | | | | | | | | | Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
* Add ability to restore `RandomNumberGenerator` stateAndrii Doroshenko (Xrayez)2020-12-071-3/+4
| | | | | | | - added `state` as a property to restore internal state of RNG; - `get_seed()` returns last seed used to initialize the state rather than the current state. Co-authored-by: MidZik <matt.idzik1@gmail.com>
* Exposed randi_range to global funcs + renamed rand_range to randf_rangeYuri Roubinsky2020-11-061-1/+1
|
* Fix biased output of randi_rangeYuri Roubinsky2020-10-291-0/+4
|
* Linux/BSD: Fix support for NetBSDRémi Verschelde2020-09-181-3/+2
| | | | | | | | | Add __NetBSD__ to `platform_config.h` so that it can find `alloca` and use the proper `pthread_setname_np` format. Rename RANDOM_MAX to avoid conflict with NetBSD stdlib. Fixes #42145.
* typedefs: Cleanup unused macros and unnecessary checksRémi Verschelde2020-03-111-4/+4
| | | | | | | | | | We now require a compiler with C++17 support, so we don't need to check for features added to GCC 5 or Clang 3.2. Clang builtin availability checks were unused anyway as Clang defines `__GNUC__` as it's also a GNU C implementation. Fixes #36986.
* Update copyright statements to 2020Rémi Verschelde2020-01-011-2/+2
| | | | | | | | | | | Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
* Merge pull request #27193 from toasteater/fix/pcg-randfRémi Verschelde2019-06-121-2/+60
|\ | | | | Improved uniformity of RandomPCG::randf.
| * Improved uniformity of RandomPCG::randf.toasteater2019-03-191-2/+60
| | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #27043 from Chaosus/randfnYuri Roubinsky2019-04-071-0/+9
|\ \ | | | | | | Added gaussian distribution function to RNG
| * | Added normally distributed generation function to RNGChaosus2019-03-171-0/+9
| |/
* / Properly setup seed in RNGChaosus2019-03-271-3/+3
|/
* Fix -Wc++11-extensions warning after #26737Rémi Verschelde2019-03-071-1/+1
| | | | Fixes #26769.
* Fixed get_seed() not returning the correct seed.MidZik2019-03-071-8/+13
|
* Fix random generation, to not retrieve 0 after seed()Chaosus2019-02-101-1/+4
|
* Revert "Revert "Update random_pcg.h""Rémi Verschelde2019-01-231-2/+2
| | | | | | This reverts commit 6f704c338aa7448a65ced554804ae568063f35eb. Sorry about this, this was a test and not meant to be pushed to master. :/
* Revert "Update random_pcg.h"Rémi Verschelde2019-01-231-2/+2
| | | | This reverts commit 64e584a97e0505cec592d3c98a2899ba8426f35a.
* Fix HTML5 build warningLeon Krause2019-01-201-2/+2
|
* Update random_pcg.hCalamander2019-01-071-2/+2
| | | little fix to function types
* Update copyright statements to 2019Rémi Verschelde2019-01-011-2/+2
| | | | Happy new year to the wonderful Godot community!
* Implement random number generatorChaosus2018-11-131-0/+61
Co-authored-by: Zirak <zirakertan@gmail.com>