-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from bashtage/xoroshiro
ENH: Add xoroshiro128+ prng
- Loading branch information
Showing
25 changed files
with
2,687 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.. _change-log: | ||
|
||
Change Log | ||
========== | ||
|
||
Version 1.11.1 | ||
-------------- | ||
|
||
* Added xoroshiro128+ PRNG. This is an improved version of the xorshirt128+ | ||
PRNG and should be used instead. In the long run, xorshift128+ will likely | ||
be removed. | ||
* Fixed DeprecationWarning when initializing a PRNG using a single element | ||
array. | ||
|
||
Version 1.11 | ||
------------ | ||
|
||
* Update to recent changes in NumPy's RandomState | ||
* Expose system entropy through :meth:`randomstate.entropy.random_entropy` | ||
* Add vector initialization for all PRNGs | ||
|
||
Version 1.10.1 | ||
-------------- | ||
|
||
* Added support for jumping the MRG32K3A generator | ||
* Added support for jumping the dSFMT generator | ||
* Update to recent changes in NumPy's RandomState | ||
|
||
Version 1.10 | ||
------------ | ||
|
||
* This is the initial release with compatibility with NumPy 1.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
XorShift128+ Randomstate | ||
************************ | ||
|
||
.. currentmodule:: randomstate.prng.xoroshiro128plus | ||
|
||
|
||
Random generator | ||
================ | ||
.. autoclass:: | ||
RandomState | ||
|
||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
seed | ||
get_state | ||
set_state | ||
|
||
Parallel generation | ||
=================== | ||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
jump | ||
|
||
Simple random data | ||
================== | ||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
rand | ||
randn | ||
randint | ||
random_integers | ||
random_sample | ||
random | ||
ranf | ||
sample | ||
choice | ||
bytes | ||
random_uintegers | ||
random_raw | ||
|
||
Permutations | ||
============ | ||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
shuffle | ||
permutation | ||
|
||
Distributions | ||
============= | ||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
beta | ||
binomial | ||
chisquare | ||
dirichlet | ||
exponential | ||
f | ||
gamma | ||
geometric | ||
gumbel | ||
hypergeometric | ||
laplace | ||
logistic | ||
lognormal | ||
logseries | ||
multinomial | ||
multivariate_normal | ||
negative_binomial | ||
noncentral_chisquare | ||
noncentral_f | ||
normal | ||
pareto | ||
poisson | ||
power | ||
rayleigh | ||
standard_cauchy | ||
standard_exponential | ||
standard_gamma | ||
standard_normal | ||
standard_t | ||
triangular | ||
uniform | ||
vonmises | ||
wald | ||
weibull | ||
zipf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
randomstate/interface/xoroshiro128plus/xoroshiro128plus-shim.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "xoroshiro128plus-shim.h" | ||
|
||
extern inline uint32_t random_uint32(aug_state* state); | ||
|
||
extern inline uint64_t random_uint64(aug_state* state); | ||
|
||
extern inline double random_double(aug_state* state); | ||
|
||
extern inline uint64_t random_raw_values(aug_state* state); | ||
|
||
void set_seed(aug_state* state, uint64_t seed) | ||
{ | ||
xoroshiro128plus_seed(state->rng, seed); | ||
} | ||
|
||
void set_seed_by_array(aug_state* state, uint64_t *vals, int count) | ||
{ | ||
xoroshiro128plus_seed_by_array(state->rng, vals, count); | ||
} | ||
|
||
|
||
void entropy_init(aug_state* state) | ||
{ | ||
uint64_t seed[1]; | ||
entropy_fill((void*) seed, sizeof(seed)); | ||
xoroshiro128plus_seed(state->rng, seed[0]); | ||
} | ||
|
||
void jump_state(aug_state* state) | ||
{ | ||
xoroshiro128plus_jump(state->rng); | ||
} | ||
|
||
void init_state(aug_state* state, uint64_t* state_vals) | ||
{ | ||
xoroshiro128plus_init_state(state->rng, *(state_vals), *(state_vals + 1)); | ||
} | ||
|
Oops, something went wrong.