Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    RandomSources 0.1.3

    Download button

    No screenshots available
    Downloads: 59  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Eric Astor | More programs
    GPL v3 / FREE
    July 20th, 2012, 15:04 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    RandomSources description

    Drop-in replacements for Random, providing remote random-number sources

    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)
    [0.5996488097316547, 0.40146785806967766, 0.9956706001515375, 0.345638811037305]
    >>> randomDotOrg.checkBitQuota()
    989910
    >>> print randomDotOrg.randint(1, 20)
    1
    >>> print randomDotOrg.randint(1, 20, 12)
    [6, 10, 13, 20, 3, 14, 5, 3, 10, 18, 20, 14]
    >>> randomDotOrg.checkBitQuota()
    989780


    Note 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

    Requirements:

    · Python

      


    TAGS:

    random-number sources | Python library | Python | random-number | sources

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM