Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PiRan: Random numbers based on Pi

1. Disclaimer and license

Disclaimer

I use the word "random" for the data generated by this library. Thought, all of this is mathematically false. So do not use this for any serious purpose.

License

GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. https://fsf.org/

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA, or see https://www.gnu.org/licenses/.

2. Project overview

  • Author: Firefnix
  • Coded in Python 3.8
  • Licensed under LGPL-3-or-later
  • Source code: here

3. Usage examples

To build the digits calculator and compute:

from piran import build, compute
build() # pi.c -> pi.so
compute(10000) # Ten thousand digits!

Note that this is only needed once. Ten thousand digits are usually computed in less than a second. Now we can really use the library:

from piran import Random
r = Random() # Creates a cursor file
for i in range(10):
    print("unsigned int:", r.uint(10), "\nsigned int:", r.sint(-10, 10))

r.close() # Deletes the cursor file

4. Explanations

I'm actually not very good at math. But we all know that:

Pi is an irrationnal number. Thus, its decimals never repeat themselves.

So I worked on the (mathematically false) assumption that if pi's decimals never repeat themselves, then these decimals can be considered "random".

Metadata

Release files for piran 0.1b8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for piran 0.1b8
File Size Uploaded
piran-0.1b8.tar.gz 8.6 kB Details

Release files / piran-0.1b8.tar.gz

Download URL piran-0.1b8.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
88ab354697fc350e2dfacaa769080cc5394c1b251a3f653d0538d06697a534cf
BLAKE2b-256 checksum
How to use checksums
a4c997edd89f5b4f4e04fd14a56fd22b8dd660bb6c2b5f532f3044237ffa8bdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page