Skip to main content

Generate random vectors whose components sum up to one

This Python3 module implements different approaches [1] to randomly and uniformly generate d-dimensional vectors whose components sum up to one.

[1] Maziero, J. Generating Pseudo-Random Discrete Probability Distributions. Brazilian Journal of Physics 45, 377–382 (2015). https://doi.org/10.1007/s13538-015-0337-8

Installation

Run the following to install the module:

pip install pyrandvec

Usage

from pyrandvec import sample

# Generate 10 4-dimensional vectors with the simplex-method
sample(10, 4, method = 'simplex')

# Generate 10 3-dimensional vectors with the trigonometric methdod with subsequent shuffling
sample(10, 3, method = 'trigonometric', shuffle = True)

Developing randvec

To install the pyrandvec module along with the tools you need to develop and run test, run the following command in your virtual environment (virtualenv):

pip install -e .[dev]

Metadata

Release files for pyrandvec 1.0.1

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

Source distribution (sdist)

Source distribution for pyrandvec 1.0.1
File Size Uploaded
pyrandvec-1.0.1.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyrandvec 1.0.1
File Interpreter ABI Platform
pyrandvec-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / pyrandvec-1.0.1.tar.gz

Download URL pyrandvec-1.0.1.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6de9287320ae7c5b929cb786e8f011c3235c248809d3332e2fd1c32c5ea19c65
BLAKE2b-256 checksum
How to use checksums
a19a82f2046197de459f08f5588782962cbb4a802552d5021a2d4ead87874b7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release files / pyrandvec-1.0.1-py3-none-any.whl

Download URL pyrandvec-1.0.1-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91d16a79060911d3978b0d68911614f92f056a45333f523e5bb08cb24f4fd77a
BLAKE2b-256 checksum
How to use checksums
70e326dd55e84eee438e9054080aa6a6799d100ae0560e76c6e84089e26639cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

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