Skip to main content

A library for generating random text, numbers, and structured data.

Project description

This library provides utilities to generate mock data for testing purposes, including numbers, text, identifiers, and structured data.

Modules Overview

Installation

!pip install randomcontent

  1. Number Generator

    • Generate random integers, floats, or numbers with custom ranges.
    • Example:
      from randomcontent import generate_number
      generate_number(type="int", min=1, max=100)  # Generates an random integer between 1 and 100
      generate_number(type="probability") # Generates an random probability between 0 and 1
      generate_number(type="gaussian",mean=0, std_dev=1) # Generates an random number from Gaussian distribution
      
  2. Identifier Generator

    • Generate unique identifiers like UUIDs, credit card numbers, or custom IDs.
    • Example:
      from randomcontent import generate_identifier
      generate_identifier(type="uuid")  # Generates and random UUID-like string
      generate_identifier(type="email") # Generates an email address
      
  3. Text Generator

    • Create random names, email addresses, or custom text strings.
    • Examples:
      from randomcontent import generate_text
      generate_text(type="sentence", length=12)  # Generates a sentence
      generate_text(type="poem", num_lines=4)   # Generates a poem
      
  4. Structured Data Generator

    • Generate structured mock data based on a schema definition.
    • Example:
      from randomcontent import generate_structured_data, format_data
      schema = {"name": "random_name", "email": "random_email","age": "random_int(min=18, max=60)"}
      generate_structured_data(schema, count=5)  # List of 5 data rows
      

Formatting Data

Structured data can be saved in JSON, CSV, or Parquet formats:

  • Example:
    from randomcontent import format_data
    format_data(data, format_type="json", file_name="data")  # Save as data.json
    format_data(data, format_type="csv", file_name="data")   # Save as data.csv
    format_data(data, format_type="parquet", file_name="data")  # Save as data.parquet
    

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

randomcontent-1.0.2.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

randomcontent-1.0.2-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file randomcontent-1.0.2.tar.gz.

File metadata

  • Download URL: randomcontent-1.0.2.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for randomcontent-1.0.2.tar.gz
Algorithm Hash digest
SHA256 8e58a4f221d92ed11b04c58a19400ef79ab743addc61d92c1dce0601562b1619
MD5 3dd9025f66e7f3d5f72f046eed0a82eb
BLAKE2b-256 4a4463ce276fdbeefa44d76d4b630c81c61ffd1c7bd74a8970a942d2ea79ccdc

See more details on using hashes here.

File details

Details for the file randomcontent-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: randomcontent-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for randomcontent-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 17cbea50b417ab81f1ae0e46808aac66155ea44799191cb6c73ea4cb85a16372
MD5 e7616c4ea74ef7ef58b13b4ee4110e10
BLAKE2b-256 ca5a90e8c2046a924580113fab12fba4603846f6f675d12dad9314ef0af66612

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