RandomSourcesDrop-in replacements for Random, providing remote random-number sources | |
Download |
RandomSources Ranking & Summary
Advertisement
RandomSources Tags
RandomSources Description
RandomSources is a Python module, providing multiple implementations of Python's random-number generator interface backed by remote random-number sources. It provides simple, drop-in style replacements for Random with data provided by the ANU Quantum Random Numbers server (generated by measuring quantum fluctuations of the vacuum) and by random.org (generated by measuring atmospheric noise). Typical usage looks like this:>>> import randomSources>>> qRandom = randomSources.QuantumRandom()>>> print qRandom.random()0.799872387678>>> print qRandom.randint(1, 20)4>>> randomDotOrg = randomSources.RandomDotOrg()>>> randomDotOrg.checkBitQuota()990178>>> print randomDotOrg.random()0.951470705142>>> print randomDotOrg.random(4)>>> randomDotOrg.checkBitQuota()989910>>> print randomDotOrg.randint(1, 20)1>>> print randomDotOrg.randint(1, 20, 12)>>> randomDotOrg.checkBitQuota()989780Note that random.org provides a bit quota limited per IP per 24 hours; many functions therefore provide an optional final parameter 'n' to simulate multiple calls, allowing the system to merge some smaller requests in order to minimize bit waste. Towards the same goal, the RandomDotOrg class prefers to subdivide fetches, sending multiple smaller requests when it can prevent waste.On the other hand, the ANU Quantum Random Numbers server has no bit limit; therefore, the QuantumRandom class fetches 16 KB at a time to serve small requests, minimizing requests to the server. Larger requests are fetched dynamically.Product's homepage
RandomSources Related Software