Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

igenerator-0.0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

igenerator-0.0.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file igenerator-0.0.1.tar.gz.

File metadata

  • Download URL: igenerator-0.0.1.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

Hashes for igenerator-0.0.1.tar.gz
Algorithm Hash digest
SHA256 872a92bc1b8236407c196d909ca1992220e89bf1976ccda3b61e66333bb366c5
MD5 d5e99385e80be58b1f4319dc41a00a3f
BLAKE2b-256 381925c4cc0a1b93d02da0b1935c1610be76a2006098656342ed443124a1dc03

See more details on using hashes here.

File details

Details for the file igenerator-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: igenerator-0.0.1-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

Hashes for igenerator-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 51f6a4712f864bbe62831fef7f14406e5c61fc5fca012ae174354841ebd87987
MD5 5ef011b298b387df98575a6fda25b295
BLAKE2b-256 afbbdd30f77afb03547dd49cdfd02889e9fae18c1b95e2c073ffca776cace9b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page