Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Access to Cryptographic API random generator

Project Description

This module gives direct access to Windows Cryptographic

API CryptGetRandom() function. The range() function uses B.5.1.1 Simple Discard Method from NIST SP800-90 with FIPS 140-2 p. 44 Continuous random number generator test.


>>> import winrandom
>>> print winrandom.long()
>>> print repr(winrandom.bytes(10))
<10 random bytes>
>> print winrandom.range(1000)

Changelog: 1.0 added winrandom.long() 1.1 added winrandom.bytes(num) returning num random bytes 1.2 added winrandom.range(max) returning random index n where 0 <= n < max

Release History

This version
History Node


History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(202.0 kB) Copy SHA256 Hash SHA256
Windows Installer 2.7 Jan 20, 2012
(3.5 kB) Copy SHA256 Hash SHA256
Source None Jan 20, 2012

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers