Generating random numbers faster than numpy
Project description
igenerator
igenerator is a python package that allows you to generate psudo random numbers and write them to a CSV file or SQLite database with just a few lines of code. The package utilizes the JAX function which is based on the C++ library random123. These functions are designed to be fast and efficient, and are suitable for use in machine learning applications.
Installation
You can install the package using pip:
pip install igenerator
Usage
To use the package, you first need to import it:
from igenerator import LiveGenerator
Then, you can create an instance of the TrueGenerator class:
generator = LiveGenerator()
or
generator = LiveGenerator(0) # Pass a optional parameter (i.e any integer ) to set the seed val.
You can use the randomInt() method to generate a list of random integers within a certain range:
result = generator.randomInt(2, 15, 4)
The above code will generate a list of 4 random integers between 2 and 15 (inclusive).
You can then use the writeCsv() method to write the list of random numbers to a CSV file:
generator.writeCsv(result, 'your_csv_name.csv')
Note
Before writing into a csv file remember to create one with desired headers.
And use the writeSql() method to write the list of random numbers to a SQLite database:
table_name = "your_table_name"
generator.writeSql(result,'your_database_name.db',table_name)
Note
Before writing into a sqlite database remember to create a table with desired headers.
Example :
from igenerator.generate import LiveGenerator
generator = LiveGenerator()
result = generator.randomInt(2,15,4) # For float values use randomFloat
generator.writeCsv(result,'your_csv_name.csv')
table_name = "your_table_name"
generator.writeSql(result,'your_database_name.db',table_name)
License
This package is released under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file igenerator-0.0.2.tar.gz.
File metadata
- Download URL: igenerator-0.0.2.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d9fc4ec147e9ea630a332e3629576a239e039de509393229b01a280b4355b29
|
|
| MD5 |
867bca819ff9ac954da58031e3426e74
|
|
| BLAKE2b-256 |
86ec14e8801fa70001eecab5f4125db45116a778a7f41e43faabb2e90e7a4199
|
File details
Details for the file igenerator-0.0.2-py3-none-any.whl.
File metadata
- Download URL: igenerator-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0bb19ca9b87544f48421d41bb58222ea5345cb7ab040974740da5765baa0b47
|
|
| MD5 |
70b3ef52b1f44e78f0d655ba079ef097
|
|
| BLAKE2b-256 |
04a71d3781e85dfcd2f88e7a9b7d8c872e46884345aa5eff1dcf9d706ac1c179
|