Skip to main content

Pure Python clone of fastrand

Project description

python-fastrand

A pure python clone of lemire/fastrand

Installation

With pip:

pip install python-fastrand

From source:

git clone https://github.com/mukundan314/python-fastrand.git
cd python-fastrand
python setup.py install

Usage

All methods are compatible with the ones in lemire/fastrand provided in the pyfastrand module

>>> import pyfastrand
>>> pyfastrand.pcg32bounded(1000)
498
>>> pyfastrand.pcg32()
1547545700

Benchmarks

$ bash benchmark.sh
_random.Random().random
2000000 loops, best of 5: 156 nsec per loop

fastrand.pcg32
2000000 loops, best of 5: 137 nsec per loop

fastrand.pcg32bounded
5000000 loops, best of 5: 78.2 nsec per loop

os.urandom
500000 loops, best of 5: 865 nsec per loop

pyfastrand.pcg32
500000 loops, best of 5: 634 nsec per loop

pyfastrand.pcg32bounded
500000 loops, best of 5: 749 nsec per loop

random.randint
500000 loops, best of 5: 822 nsec per loop

random.random
2000000 loops, best of 5: 169 nsec per loop

Project details


Release history Release notifications | RSS feed

This version

1.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

python_fastrand-1.1-py2.py3-none-any.whl (3.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file python_fastrand-1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: python_fastrand-1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for python_fastrand-1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3e8fe2eb8dc386a6cd881068ef89e3de711559492e2c2a960aa8f2128d3a1f06
MD5 f3799cf4c3ecd81fc39b9da1f0ea70ff
BLAKE2b-256 1f08f8fe0ff100da459430ad9f50831e71fdcae5e8fc46f550bccc563cdadd29

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page