RandDist
python random generator with custom probability distribution
This minimal package generates a list of int or float numbers within a specific range and steps with custom probability distribution.
How to use
install
pip install randdist
include
import randdist
generate
numbers_list = randdist.randint(0, 10, formula = lambda x:x**2)
Methods
randint: Generates integer numbersrandfloat: Generates float numbers
Parameters
min_value: startmax_value: stopstep: bin step sizedefault = 1formula: lambda function for distribution curvedefault = lambda x:xseeds: # of generated numbersdefault = 1000sample_size: # of numbers to returndefault = 00: return a list of generated numbers.1: return only one int or float number2 or more: returns a list with the specified amount of numbers. sample_size can't be more than seeds.
Outputs
Depending on sample_size:
list: a list of shuffled generated numbers orsample: an integer of a float number from the list
Demo
min_value = -3max_value = 3step = 0.5formula = lambda x:12-(x**2)seeds = 1000
# generate int numbers
random_list_int = randdist.randint(min_value, max_value, step, formula, seeds)
# generate float numbers
random_list_float = randdist.randfloat(min_value, max_value, step, formula, seeds)
Test Distribution
with 10K generated numbers
# pick samples from 10K generated list of numbers
generated_list = []
for i in range(10000):
sample_int = randdist.randint(-3, 3, 0.5, lambda x:12-(x**2), sample_size = 1)
generated_list.append(sample_int)
Metadata
Release files for RandDist 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| RandDist-0.0.6.tar.gz | 4.1 kB | Without provenance | Details for RandDist-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| RandDist-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for RandDist-0.0.6-py3-none-any.whl |
Total release size: 8.9 kB
Release files / RandDist-0.0.6.tar.gz
| Download URL | RandDist-0.0.6.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51069e2b7d6182b40b015fd237d6fb6fe1a049f613bd169d1ea641b319269284
|
|
BLAKE2b-256 checksum How to use checksums |
11e08d3bbd48a3fe84e32efe7a676faea82471fe53183771cb2ca120d0486357
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|
Release files / RandDist-0.0.6-py3-none-any.whl
| Download URL | RandDist-0.0.6-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0dce4c50803ae699788cdd4a87f0a7347dfc0ae7f6620ff8de598ef0d0d304d1
|
|
BLAKE2b-256 checksum How to use checksums |
c5700adef3f4214a7cb4dd4eef5bb0442a93f3357db0ae06aaebbee06dcceea5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|
Security for RandDist 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.