Skip to main content

Multiplicative Generative Method (MGM)

Project description

Mugem

Mugem (Multiplicative Generative Method) is a lightweight Python package that generates pseudo-random numbers using the Multiplicative Congruential Method (MCM). it is widely used random number generation algorithm defined by the recurrence relation:

It returns both the raw sequence of generated numbers and their normalized versions between [0, 1) using NumPy.


🔧 Features

  • Easy-to-use function interface
  • Pure Multiplicative Congruential Method (no increment term)
  • Fast random number generation
  • Normalized output with NumPy
  • User-defined input parameters

📦 Installation

Install via pip:

pip install mugem

(Use after publishing to PyPI)


🚀 Usage

from mugem import mgm

# Define parameters
a = 2        # Multiplier
x0 = 5       # Seed value
m = 103      # Modulus
count = 10   # Number of values

# Generate pseudo-random numbers
y, u = mgm(a, x0, m, count)

print("Generated:", y)
print("Normalized:", u)

📄 Function Reference

def mgm(a: int, x0: int, m: int, count: int = 10):
    """
    Multiplicative Congruential Method (MCM) to generate pseudo-random numbers.

    Parameters:
        a (int): Multiplier
        x0 (int): Initial seed value
        m (int): Modulus
        count (int): Total numbers to generate

    Returns:
        tuple:
            y (list): Raw generated integers
            u (ndarray): Normalized values in [0, 1)
    """

🧪 Example Script

from mugem import mgm

a, x0, m, count = 2, 5, 103, 10
y, u = mgm(a, x0, m, count)

print("Generated Sequence:", y)
print("Normalized Sequence:", u)

👤 Author

Rohit Kumar Behera

📧 Email: rohitmbl24@gmail.com 🔗 PyPI: [https://pypi.org/project/mgm/] (after publishing)


Feel free to contribute, suggest improvements, or report issues.

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

mugem-1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

mugem-1.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file mugem-1.0.tar.gz.

File metadata

  • Download URL: mugem-1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for mugem-1.0.tar.gz
Algorithm Hash digest
SHA256 6d74b5e2b72ac71f00089c6fd7e1226449a617a4927e78796838a1cd1dbe6f06
MD5 1484d94b43800673cbe879b758954b3b
BLAKE2b-256 4ea4855f3cb630a7aaa6fd49a1407ad356d7b202787da6b0aeeedb7db38d5646

See more details on using hashes here.

File details

Details for the file mugem-1.0-py3-none-any.whl.

File metadata

  • Download URL: mugem-1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for mugem-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e43c4a6b04595074c2a1346cfe9f7af273aff22bb9b87cec8b20574dc2837fd
MD5 f6c950aa2d099d7518d852ee19e76208
BLAKE2b-256 904fe4c5a6dd7806b19cebb69e3d359ca2b1ad3a2954853ca31703714784652b

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