Skip to content

Commit

Permalink
Initial creation and population of the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
ericastor committed Jul 13, 2012
0 parents commit 9b6bd7c
Show file tree
Hide file tree
Showing 11 changed files with 995 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
163 changes: 163 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
#################
## Eclipse
#################

*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath


#################
## Visual Studio
#################

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results
[Dd]ebug/
[Rr]elease/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds
*.dotCover

## TODO: If you have NuGet Package Restore enabled, uncomment this
#packages/

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf

# Visual Studio profiler
*.psess
*.vsp

# ReSharper is a .NET coding add-in
_ReSharper*

# Installshield output folder
[Ee]xpress

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish

# Others
[Bb]in
[Oo]bj
sql
TestResults
*.Cache
ClientBin
stylecop.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML



############
## Windows
############

# Windows image file caches
Thumbs.db

# Folder config file
Desktop.ini


#############
## Python
#############

*.py[co]

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox

#Translations
*.mo

#Mr Developer
.mr.developer.cfg

# Mac crap
.DS_Store
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
v0.1.1, 7 July 2012 -- Minor changes to project structure and text.

v0.1.0, 7 July 2012 -- Initial release.
186 changes: 186 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CHANGES.txt
LICENSE.txt
README.txt
setup.py
randomSources\__init__.py
randomSources\quantumRandom.py
randomSources\randomDotOrg.py
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include *.txt
recursive-include docs *.txt
73 changes: 73 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
=============
RandomSources
=============

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.

As of version 0.1.0, these objects are *not* thread-safe.

Credits
=======

Much of the code of this module is derived directly from the Python 2.7 source
for the Random class and its subclasses, rendering this a derivative work.
Thanks to the Python Software Foundation and its BDFL, Guido van Rossum.

In addition, significant inspiration (and some direct code) was taken from the
quantumrandom (http://github.com/lmacken/quantumrandom) and randomdotorg
(http://code.google.com/p/randomdotorg/) modules, especially as basic reference
for the APIs of their respective random-number sources. Thanks and attribution
are therefore due to Luke Macken (author of quantumrandom) and Clovis Fabricio
(author of randomdotorg).

License
=======

This module is licensed under the GNU GPL version 3, as a derivative work of
the randomdotorg module. This is confirmed compatible with both the Python
Software Foundation License, covering Python 2.7, and the MIT License, covering
the quantumrandom module.

If permission is granted by Clovis Fabricio, this module will be relicensed
under the Python Software Foundation License, or, if that is not acceptable,
under the GNU LGPL version 3.
4 changes: 4 additions & 0 deletions randomSources/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env python

from quantumRandom import QuantumRandom
from randomDotOrg import RandomDotOrg
Loading

0 comments on commit 9b6bd7c

Please sign in to comment.