Getting Started
This Python package provides a wrapper for the Random.org API to generate various types of random data such as integers, sequences, decimal fractions, Gaussian numbers, strings, UUIDs, and random blobs.
Features
Generate random integers, integer sequences, decimal fractions, and Gaussian-distributed numbers.
Generate random strings, UUIDs, and blobs.
Retrieve API usage statistics, including remaining bits and requests.
Installation and Setup
Install the package from PYPI:
pip install py-random-dot-org
Visit https://api.random.org/ and fetch an api key.
Usage
Import the
BasicApiclass and initialize it with your Random.org API key:from py_random_dot_org.basic_api import BasicApi api = BasicApi(api_key="your_api_key")
Call the available methods to generate random data. For example, to generate random integers:
random_integers = api.generate_integers(num=5, minimum=1, maximum=100) print(random_integers)
You can also check your API usage:
usage_stats = api.get_usage() print(usage_stats)
Running Tests
The project includes tests written using pytest. To run the tests:
Install
pytest:pip install pytest
Run the tests:
pytest
License
This project is licensed under the MIT License. See the LICENSE file for details.