Current section

Files

Jump to
sfmt CHANGES.md
Raw

CHANGES.md

# List of changes on sfmt-erlang
## Use 0.13.2 and later for OTP 23
* erlang.mk is updated to stop using `-lerl_interface`. This is required for successfully build in OTP 23.
## Security notice added
See `Security notice regarding the PHP mt_seed() vulnerability` in the README.md.
## Pigeonhole principle enforced
* From 0.13.0
* See Issue #23 at https://github.com/jj1bdx/sfmt-erlang/issues/23
* On `uniform/1` and `uniform_s/2`
* This will enforce the probability values for all possible numbers showing up in the random number sequence of X ranged in `1 <= X <= N` are equal with each other
## Possible errors on mixing up floats and integers existed on 0.12.8 and older versions
* 0.12.8 and older versions had a bug of possibly mixing up floats and integers when sfmt:uniform/0 and sfmt:uniform/1 are called in sequence
* From 0.13.0, float values are no longer precomputed and generated from 32-bit integers of SFMT output each time. `uniform/0` and `uniform_s/1` are affected
* _Float NIFs are no longer available_ from 0.13.0
## output interval changed to (0.0, 1.0)
* `uniform/0` and `uniform_s/1` output `X` range: `0.0 < X < 1.0` (from 0.12.0)
* This change fixes the scaling bug on `uniform/1`, `uniform_s/2`
* Thx @timCF on GitHub for pointing this out
## seeding semantics now consistent between sfmt and sfmt_pure modules
* `sfmt_pure:seed0/0` is fixed to be consistent with `sfmt_seed0/0` (from 0.12.0)
## hex.pm support added
* Based on the contribution from Michael Chmielewski (from 0.10.1)
* Package name on hex.pm: sfmt
* hexdocs.pm supported (from 0.12.8)
## NIF code simplified
* All atoms defined inside the NIF code are removed (from 0.10.0)
* if `enif_alloc()` fails, `enif_make_badarg()` is called instead of returning `error_sfmt_nomem` (from 0.10.0)
## Test framework changed from EUnit to Common Test
* Common Test source included under `test/` (from 0.10.0)
## Rebar dependency removed
* Rebar dependency removed, now uses erlang.mk (from 0.10.0)
* Uses erlang.mk NIF support (from 0.10.0)
## Pure Erlang SFMT module
* Pure Erlang SFMT module now added as working code by request (from 0.8.0\_RELEASE)
## Seeding algorithm changed for `seed(integer())` functions
* The old `seed/1` function called `init_gen_rand/1` (up to 0.8.0\_RELEASE)
* The internal state generated by `init_gen_rand/1` is predictable,
especially when the value of the 1st element of the state list is
very close to the given seed value.
(Michael Gebetsroither discovered this behavior)
* The new `seed/1` function calls `init_by_list32/1` (from 0.8.1\_RELEASE)
and the seed is given as `[integer()]`,
to reduce predictability of the 1st element of the state list.
## C NIFs
* MSC/BORLANDC compilation flags removed (from 0.9.1\_BETA)
* C NIFs based on SFMT 1.3.3 added (from 0.3.0\_RELEASE)
* The version number of this NIF is 101 (see `NIF_LOAD_INFO` macro value)
## Notable bugfixes
* asn1 application now starts before starting up public\_key application on `support/getrebar` (from 0.9.1\_BETA)
* `gen_rand_all/1` is now properly applied in `sfmt_pure` module when `gen_rand32/1` was first invoked (from 0.8.2\_RELEASE)
* Catched up with the latest rebar configuration file (from 0.7.0\_RELEASE)
* Dynamically building ebin/sfmt.app (from 0.7.0\_RELEASE)
* PDIC\_SEED now named differently for each period (bugfix, from 0.5.2\_RELEASE)
## Removed code
* Wichmann-Hill 2006 RNG code is removed
* netpbm test code is removed
## Notes on refactoring
* Speedup by NIF: ~40 times faster than the pure Erlang code
(when fully inline-optimized (see rebar.config))
* For the pure-Erlang code: writing `++` (append) operators by ring buffer loops
(as a pair of lists consuming the head elements, and the corresponding accumulators)
made the code ~50% faster; the pure Erlang code available under `reference_texts/`
* `gen_rand32/1`, `gen_rand32_max/2`, and `gen_rand_float/1` use Erlang lists
(Dan Gudmudsson showed the list version is faster)
* SSE2 code and options in sfmt-extstate were removed due to causing crash of Erlang BEAM
(and even if the SSE2 code was enabled the performance increase would be minimal)