这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ environment:
- PY_MAJOR_VER: 3
PYTHON_ARCH: "x86"

platform:
- x64

build_script:
- ps: Start-FileDownload "https://repo.continuum.io/miniconda/Miniconda$env:PY_MAJOR_VER-latest-Windows-$env:PYTHON_ARCH.exe" C:\Miniconda.exe; echo "Finished downloading miniconda"
- cmd: C:\Miniconda.exe /S /D=C:\Py
Expand Down
2 changes: 1 addition & 1 deletion randomstate/defaults.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEF RS_NORMAL_METHOD = 'zig'
DEF RS_NORMAL_METHOD = u'zig'
DEF RS_RNG_SEED = 1
DEF RS_RNG_ADVANCEABLE = 0
DEF RS_RNG_JUMPABLE = 0
Expand Down
6 changes: 3 additions & 3 deletions randomstate/interface/dSFMT/dSFMT.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEF RS_RNG_NAME = 'dSFMT'
DEF RS_RNG_NAME = u'dSFMT'
DEF RS_RNG_JUMPABLE = 1
DEF DSFMT_MEXP = 19937
DEF DSFMT_N = 191 # ((DSFMT_MEXP - 128) / 104 + 1)
Expand Down Expand Up @@ -81,7 +81,7 @@ cdef object _set_state(aug_state *state, object state_info):



DEF CLASS_DOCSTRING = """
DEF CLASS_DOCSTRING = u"""
RandomState(seed=None)

Container for the SIMD-based Mersenne Twister pseudo-random number generator.
Expand Down Expand Up @@ -162,7 +162,7 @@ state values.
Sequences and Their Applications - SETA, 290--298, 2008.
"""

DEF JUMP_DOCSTRING = """
DEF JUMP_DOCSTRING = u"""
jump(iter = 1)

Jumps the state of the random number generator as-if 2**128 random numbers
Expand Down
4 changes: 2 additions & 2 deletions randomstate/interface/mlfg-1279-861/mlfg-1279-861.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEF RS_RNG_NAME = 'mlfg-1279-861'
DEF RS_RNG_NAME = u'mlfg-1279-861'
DEF MLFG_STATE_LEN = 1279

cdef extern from "distributions.h":
Expand Down Expand Up @@ -43,7 +43,7 @@ cdef object _set_state(aug_state *state, object state_info):
state.rng.pos = state_info[1]
state.rng.lag_pos = state_info[2]

DEF CLASS_DOCSTRING = """
DEF CLASS_DOCSTRING = u"""
RandomState(seed=None)

Container for a Multiplicative Lagged Fibonacci Generator (MLFG).
Expand Down
6 changes: 3 additions & 3 deletions randomstate/interface/mrg32k3a/mrg32k3a.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEF RS_RNG_NAME = 'mrg32k3a'
DEF RS_RNG_NAME = u'mrg32k3a'
DEF RS_RNG_JUMPABLE = 1

cdef extern from "distributions.h":
Expand Down Expand Up @@ -103,7 +103,7 @@ cdef void jump_state(aug_state* state):

state.rng.loc = 2

DEF CLASS_DOCSTRING = """
DEF CLASS_DOCSTRING = u"""
RandomState(seed=None)

Container for L'Ecuyer MRG32K3A pseudo random number generator.
Expand Down Expand Up @@ -192,7 +192,7 @@ References
and substreams." Operations research 50, no. 6, pp. 1073-1075, 2002.
"""

DEF JUMP_DOCSTRING = """
DEF JUMP_DOCSTRING = u"""
jump(iter = 1)

Jumps the state of the random number generator as-if 2**127 random numbers
Expand Down
4 changes: 2 additions & 2 deletions randomstate/interface/pcg-32/pcg-32.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEF RS_RNG_NAME = 'pcg32'
DEF RS_RNG_NAME = u'pcg32'
DEF RS_RNG_ADVANCEABLE = 1
DEF RS_RNG_SEED = 2

Expand Down Expand Up @@ -35,7 +35,7 @@ cdef object _set_state(aug_state *state, object state_info):
state.rng.state = state_info[0]
state.rng.inc = state_info[1]

DEF CLASS_DOCSTRING = """
DEF CLASS_DOCSTRING = u"""
RandomState(seed=None)

Container for the PCG-32 pseudo random number generator.
Expand Down
2 changes: 1 addition & 1 deletion randomstate/interface/pcg-64/pcg-64-docstring.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEF CLASS_DOCSTRING = """
DEF CLASS_DOCSTRING = u"""
RandomState(seed=None)

Container for the PCG-64 pseudo random number generator.
Expand Down
2 changes: 1 addition & 1 deletion randomstate/interface/pcg-64/pcg-64-emulated.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEF RS_RNG_NAME = 'pcg64'
DEF RS_RNG_NAME = u'pcg64'
DEF RS_RNG_ADVANCEABLE = 1
DEF RS_RNG_SEED=2
DEF RS_PCG128_EMULATED = 1
Expand Down
2 changes: 1 addition & 1 deletion randomstate/interface/pcg-64/pcg-64.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEF RS_RNG_NAME = 'pcg64'
DEF RS_RNG_NAME = u'pcg64'
DEF RS_RNG_ADVANCEABLE = 1
DEF RS_RNG_SEED=2
DEF RS_PCG128_EMULATED = 0
Expand Down
6 changes: 3 additions & 3 deletions randomstate/interface/random-kit/random-kit.pxi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DEF RS_RNG_NAME = 'mt19937'
DEF RS_NORMAL_METHOD = 'bm'
DEF RS_RNG_NAME = u'mt19937'
DEF RS_NORMAL_METHOD = u'bm'
DEF RK_STATE_LEN = 624
DEF RS_SEED_NBYTES = 1

Expand Down Expand Up @@ -44,7 +44,7 @@ cdef object _set_state(aug_state *state, object state_info):
state.rng.key[i] = key[i]
state.rng.pos = state_info[1]

DEF CLASS_DOCSTRING = """
DEF CLASS_DOCSTRING = u"""
RandomState(seed=None)

Container for the Mersenne Twister pseudo-random number generator.
Expand Down
6 changes: 3 additions & 3 deletions randomstate/interface/xorshift1024/xorshift1024.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEF RS_RNG_NAME = "xorshift-1024*"
DEF RS_RNG_NAME = u"xorshift-1024*"
DEF RS_RNG_JUMPABLE = 1

cdef extern from "distributions.h":
Expand Down Expand Up @@ -46,7 +46,7 @@ cdef object _set_state(aug_state *state, object state_info):
state.rng.p = state_info[1]


DEF CLASS_DOCSTRING = """
DEF CLASS_DOCSTRING = u"""
RandomState(seed=None)

Container for the xorshift1024* pseudo random number generator.
Expand Down Expand Up @@ -130,7 +130,7 @@ References
generators." CoRR, abs/1403.0930, 2014.
"""

DEF JUMP_DOCSTRING = """
DEF JUMP_DOCSTRING = u"""
jump(iter = 1)

Jumps the state of the random number generator as-if 2**512 random numbers
Expand Down
6 changes: 3 additions & 3 deletions randomstate/interface/xorshift128/xorshift128.pxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEF RS_RNG_NAME = "xorshift-128+"
DEF RS_RNG_NAME = u"xorshift-128+"
DEF RS_RNG_JUMPABLE = 1

cdef extern from "distributions.h":
Expand Down Expand Up @@ -41,7 +41,7 @@ cdef inline object _set_state(aug_state *state, object state_info):



DEF CLASS_DOCSTRING = """
DEF CLASS_DOCSTRING = u"""
RandomState(seed=None)

Container for the xorshift128+ pseudo random number generator.
Expand Down Expand Up @@ -126,7 +126,7 @@ References
generators." CoRR, abs/1403.0930, 2014.
"""

DEF JUMP_DOCSTRING = """
DEF JUMP_DOCSTRING = u"""
jump(iter = 1)

Jumps the state of the random number generator as-if 2**64 random numbers
Expand Down
10 changes: 5 additions & 5 deletions randomstate/randomstate.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ IF RS_RNG_MOD_NAME == 'mlfg_1279_861':
IF RS_RNG_MOD_NAME == 'dsfmt':
include "interface/dSFMT/dSFMT.pxi"

IF RS_NORMAL_METHOD == 'bm':
__normal_method = 'bm'
IF RS_NORMAL_METHOD == u'bm':
__normal_method = u'bm'
ELSE:
__normal_method = 'zig'
__normal_method = u'zig'


cdef extern from "distributions.h":
Expand Down Expand Up @@ -150,7 +150,7 @@ cdef object _ensure_string(object s):
try:
return ''.join(map(chr, s))
except:
return s
return str(s)


cdef class RandomState:
Expand Down Expand Up @@ -1359,7 +1359,7 @@ cdef class RandomState:
(3, 4, 2)

"""
if method == 'bm':
if method == u'bm':
return double_fill(&self.rng_state, &random_gauss_fill,
size, self.lock)
else:
Expand Down
5 changes: 1 addition & 4 deletions randomstate/tests/tests_numpy_mt19937.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from numpy.compat import asbytes
import sys
import warnings

import randomstate as random
from randomstate.prng.mt19937 import mt19937

Expand Down Expand Up @@ -89,9 +88,8 @@ class TestSetState(TestCase):
def setUp(self):
self.seed = 1234567890
self.prng = random.RandomState(self.seed)
# Use legacy to get old NumPy state
self.state = self.prng.get_state()
self.legacy_state = self.prng.get_state(legacy=True)
self.legacy_state = self.prng.get_state(legacy=True) # Use legacy to get old NumPy state

def test_basic(self):
old = self.prng.tomaxint(16)
Expand Down Expand Up @@ -134,7 +132,6 @@ def test_negative_binomial(self):
# arguments without truncation.
self.prng.negative_binomial(0.5, 0.5)


class TestRandint(TestCase):

rfunc = random.randint
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def cythonize(e, *args, **kwargs):
'Topic :: Security :: Cryptography']

setup(name='randomstate',
version='1.10.1',
version='1.11.0',
classifiers=classifiers,
packages=find_packages(),
package_dir={'randomstate': './randomstate'},
Expand Down