Skip to content

Commit

Permalink
Merge pull request #6 from bashtage/rename-randomgen
Browse files Browse the repository at this point in the history
REF: Rename from Core PRNG to RandomGen
  • Loading branch information
bashtage committed Mar 14, 2018
2 parents 3e3c9a9 + 9785c12 commit 9f34087
Show file tree
Hide file tree
Showing 143 changed files with 1,305 additions and 1,312 deletions.
2 changes: 1 addition & 1 deletion _randomgen/.gitattributes
@@ -1 +1 @@
core_prng/_version.py export-subst
randomgen/_version.py export-subst
6 changes: 3 additions & 3 deletions _randomgen/.travis.yml
Expand Up @@ -37,16 +37,16 @@ before_install:
- PKGS="${PKGS} numpy"; if [ ${NUMPY} ]; then PKGS="${PKGS}=${NUMPY}"; fi
- PKGS="${PKGS} Cython"; if [ ${CYTHON} ]; then PKGS="${PKGS}=${CYTHON}"; fi
- PKGS="${PKGS} pandas"; if [ ${PANDAS} ]; then PKGS="${PKGS}=${PANDAS}"; fi
- conda create -n core-prng-test ${PKGS} pytest setuptools nose --quiet
- source activate core-prng-test
- conda create -n randomgen-test ${PKGS} pytest setuptools nose --quiet
- source activate randomgen-test
- pip install tempita -q

install:
- python setup.py develop

script:
- set -e
- pytest core_prng
- pytest randomgen
- |
if [[ -z ${NUMPY} ]]; then
python benchmark.py;
Expand Down
2 changes: 1 addition & 1 deletion _randomgen/MANIFEST.in
@@ -1,2 +1,2 @@
include versioneer.py
include core_prng/_version.py
include randomgen/_version.py
22 changes: 11 additions & 11 deletions _randomgen/README.md
@@ -1,17 +1,17 @@
# Core PRNG
# RandomGen

[![Travis Build Status](https://travis-ci.org/bashtage/ng-numpy-randomstate.svg?branch=master)](https://travis-ci.org/bashtage/core-prng)
[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/odc5c4ukhru5xicl/branch/master?svg=true)](https://ci.appveyor.com/project/bashtage/core-prng/branch/master)
[![Travis Build Status](https://travis-ci.org/bashtage/ng-numpy-randomstate.svg?branch=master)](https://travis-ci.org/bashtage/randomgen)
[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/odc5c4ukhru5xicl/branch/master?svg=true)](https://ci.appveyor.com/project/bashtage/randomgen/branch/master)

Experimental Core Pseudo Random Number Generator interface for future
Random Number Generator using settable Basic RNG interface for future
NumPy RandomState evolution.

This is a library and generic interface for alternative random
generators in Python and NumPy.


### Compatibility Warning
Core PRNG no longer supports Box-Muller normal variates and so it not
RandomGen no longer supports Box-Muller normal variates and so it not
100% compatible with NumPy (or randomstate). Box-Muller normals are slow
to generate and all functions which previously relied on Box-Muller
normals now use the faster Ziggurat implementation.
Expand All @@ -22,7 +22,7 @@ normals now use the faster Ziggurat implementation.

```python
# import numpy.random as rnd
from core_prng import RandomGenerator, MT19937
from randomgen import RandomGenerator, MT19937
rnd = RandomGenerator(MT19937())
x = rnd.standard_normal(100)
y = rnd.random_sample(100)
Expand All @@ -36,7 +36,7 @@ z = rnd.randn(10,10)
exponential and standard gamma using the Ziggurat method

```python
from core_prng import RandomGenerator
from randomgen import RandomGenerator
# Use Xoroshiro128
rnd = RandomGenerator()
w = rnd.standard_normal(10000, method='zig')
Expand Down Expand Up @@ -110,7 +110,7 @@ PRNG implementation.
or 64-bit (`[0, 2**64-1]`)
* `jump` - Jumps RNGs that support it. `jump` moves the state a great
distance. _Only available if supported by the RNG._
* `advance` - Advanced the core RNG 'as-if' a number of draws were made,
* `advance` - Advanced the RNG 'as-if' a number of draws were made,
without actually drawing the numbers. _Only available if supported by
the RNG._

Expand All @@ -133,7 +133,7 @@ The version matched the latest version of NumPy where
## Documentation

An occasionally updated build of the documentation is available on
[my GitHub pages](http://bashtage.github.io/core-prng/).
[my GitHub pages](http://bashtage.github.io/randomgen/).

## Plans
This module is essentially complete. There are a few rough edges that
Expand Down Expand Up @@ -188,10 +188,10 @@ compiler.

## Using

The separate generators are importable from `core_prng`
The separate generators are importable from `randomgen`

```python
from core_prng import RandomGenerator, ThreeFry, PCG64, MT19937
from randomgen import RandomGenerator, ThreeFry, PCG64, MT19937
rg = RandomGenerator(ThreeFry())
rg.random_sample(100)

Expand Down
2 changes: 1 addition & 1 deletion _randomgen/appveyor.yml
Expand Up @@ -26,7 +26,7 @@ build_script:
- set "GIT_DIR=%cd%"

test_script:
- pytest core_prng
- pytest randomgen

on_success:
- cd %GIT_DIR%\
Expand Down
12 changes: 6 additions & 6 deletions _randomgen/benchmark.py
Expand Up @@ -10,12 +10,12 @@

SETUP = '''
import numpy as np
if '{prng}' == 'numpy':
if '{brng}' == 'numpy':
import numpy.random
rg = numpy.random.RandomState()
else:
from core_prng import RandomGenerator, {prng}
rg = RandomGenerator({prng}())
from randomgen import RandomGenerator, {brng}
rg = RandomGenerator({brng}())
rg.random_sample()
'''

Expand Down Expand Up @@ -44,9 +44,9 @@ def run_timer(dist, command, numpy_command=None, setup='', random_type=''):
numpy_command = command

res = {}
for prng in PRNGS:
cmd = numpy_command if prng == 'numpy' else command
res[prng] = timer(cmd, setup=setup.format(prng=prng))
for brng in PRNGS:
cmd = numpy_command if brng == 'numpy' else command
res[brng] = timer(cmd, setup=setup.format(brng=brng))

s = pd.Series(res)
t = s.apply(lambda x: '{0:0.2f} ms'.format(x))
Expand Down
123 changes: 0 additions & 123 deletions _randomgen/core_prng/distributions.pxd

This file was deleted.

0 comments on commit 9f34087

Please sign in to comment.