Age | Commit message (Collapse) | Author |
|
* raimo/rand-dev/OTP-14295:
Polish
|
|
|
|
* rand/arbitrary_normal_distributions:
rand: Support arbitrary normal distributions
Conflicts:
lib/stdlib/test/rand_SUITE.erl
|
|
Implement Xoroshiro116+ as 'exrop' with fixes.
Deprecate all old algorithms but reincarnate 'exs1024' as 'exs1024s'
and 'exsplus' as 'exsp' with fixes.
Fixes:
* Avoid skew for uniform integers caused by using a simple 'rem'
operation for range confinement. Correctness requires retry
with new random value for an unfortunate first value.
* Implement a correct algorithm that collects enough random
bits for ranges larger than the generator's precision.
* Fix uniform density for floats by acquiring 53 bits
then multiplying with 2.0^(-53) which produces floats
on the form N * 2.0^(-53).
|
|
|
|
|
|
Minimize use of guards.
|
|
Fix plugin alg type
|
|
|
|
Fixed bad specs introduced in commit ff568b5e818.
Also suppress improper_lists warnings.
|
|
Jump functions returns the state after performing jump calculation to a
rand module internal state, which is equivalent to perform a large
number of calls of calculating new states for XorShift*/+ algorithms.
This commit add jump functions for exsplus and exs1024 algorithms, and a
wrapper function jump/1. The wrapper function will cause error with
reason "not_implemented" if the jump function for the algorithm is not
implemented.
This commit adds following new functionalities:
- Add new functions rand:jump/0 and rand:jump/1
- Add the member jump to type alg_handler(), a fun for performing
the jump function
- Add jump functions for exsplus, equivalent to 2^64 calls
- Add jump functions for exs1024, equivalent to 2^512 calls
- Revise seed_put/1, seed/1, seed/2
See <https://github.com/erlang/otp/pull/1235#discussion_r86950557>
- Add dummy jump function for exs64 calling
erlang:error(not_implemented)
- Add jump function test cases as follows:
* Add Common Test group reference_jump
* Add tests for jump/0 to reference_jump_procdict/1
* Rename tests for jump/1 to reference_jump_state/1
* Rename gen_jump/1 to gen_jump_1/1
* Add Common Tests reference_jump_procdict and reference_jump_state
to the group reference_jump
- Add jump function documentation
This commit also changes the Copyright year for Kenji Rikitake's code
from 2015 to 2015-2016.
|
|
Using the new type syntax, we can specify which keys are required, and
which are optional in a way Dialyzer could use.
|
|
|
|
According to the documentation, rand:export_seed/0 should return
'undefined' if the seed has not been intialized. However, it will
create and return a seed. That means that the following code
will not work as expected:
case rand:export_seed() of
undefined -> rand:seen({1,2,3});
_ -> ok
end,
rand:uniform(Range)
|
|
|
|
It is needed in various tests. It uses the Ziggurat algorithm, which
is the fastest that I know.
|
|
The old random module contains an old algorithm which have flaws
and the api requires the user to invoke seed and or checking if seed have
been invoked, if a non constant seed is to be used.
The api contains the following features:
- The user can invoke rand:unform/[0|1] directly and get a non constant seeding.
- The api is split in functional and non functional functions,
i.e. usage of _s functions will not affect the process dictionary.
- The api contains several algorithms with different characteristics and
can be extended with new algorithms in the future.
- Contains state of the art random number generators.
- Default algorithm is taylor made for erlang to be fast on 64bits machines.
|