Skip to main content

PyRandomString

Version : 0.0.6

Author : Lakhya Jyoti Nath (ljnath)
Date : June 2019 - January 2023
Email : ljnath@ljnath.com
Website : https://www.ljnath.com

PyPI - Python Version PyPI - Wheel PyPI - Status PyPI - Downloads LGTM - Code Quality LGTM - Alerts GitHub Workflow Status Code Coverage PyPI Version License

Introduction

PyRandomString is a python library to generate N random list of string of M length It is parameterized to generate strings of random number and length which is returned as a list. It can be used to generate a large number of numbers, strings etc.

Parameters

  • count : Integer - Total number of strings to be generated (default is 10). Not applicable for get_string() method
  • max_length : Integer - Maximum length of each generated string (default is 10)
  • random_length : Boolean choice - if the length of each word should be random or not. Incase of random length the maximum value is 'max_length'
  • symbols : String - Custom symbols which you want to use during random string generation. It should be a subset of the supported symbols and it is applicable only when the 'string_type' is of type 'SYMBOLS' or '_WITH_SYMBOLS'
  • string_type : PyRandomString.StringType - Type of characters to be used for generating random strings
    • NUMERIC : 0123456789
    • SYMBOLS : " !#$%&'()*+,-./:;<=>?@[]^_`{|}~
    • ALPHABET_LOWERCASE : abcdefghijklmnopqrstuvwxyz
    • ALPHABET_UPPERCASE : ABCDEFGHIJKLMNOPQRSTUVWXYZ
    • ALPHABET_ALL_CASE : abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
    • ALPHA_NUMERIC_LOWERCASE : abcdefghijklmnopqrstuvwxyz0123456789
    • ALPHA_NUMERIC_UPPERCASE : ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    • ALPHA_NUMERIC_ALL_CASE : abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    • ALPHABET_LOWERCASE_WITH_SYMBOLS : abcdefghijklmnopqrstuvwxyz" !#$%&'()*+,-./:;<=>?@[]^_`{|}~
    • ALPHABET_UPPERCASE_WITH_SYMBOLS : ABCDEFGHIJKLMNOPQRSTUVWXYZ" !#$%&'()*+,-./:;<=>?@[]^_`{|}~
    • ALPHABET_ALL_CASE_WITH_SYMBOLS : abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" !#$%&'()*+,-./:;<=>?@[]^_`{|}~
    • ALPHA_NUMERIC_LOWERCASE_WITH_SYMBOLS : abcdefghijklmnopqrstuvwxyz0123456789" !#$%&'()*+,-./:;<=>?@[]^_`{|}~
    • ALPHA_NUMERIC_UPPERCASE_WITH_SYMBOLS : ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" !#$%&'()*+,-./:;<=>?@[]^_`{|}~
    • ALPHA_NUMERIC_ALL_CASE_WITH_SYMBOLS : abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" !#$%&'()*+,-./:;<=>?@[]^_`{|}~

How to use

import PyRandomString

py_random_string = PyRandomString.RandomString()

## calling method to get a single random string
random_string = py_random_string.get_string(string_type=PyRandomString.StringType.ALPHA_NUMERIC_ALL_CASE, random_length=False, max_length=10)
print('Single random string is {}'.format(random_string))

## calling method to get a single random string with custom symbols
random_string = py_random_string.get_string(string_type=PyRandomString.StringType.ALPHA_NUMERIC_ALL_CASE_WITH_SYMBOLS, random_length=False, max_length=10, symbols='+-*#$%^&')
print('Single random string with custom symbol is {}'.format(random_string))

## calling method to get a list of random string
random_strings = py_random_string.get_strings(string_type=PyRandomString.StringType.ALPHA_NUMERIC_ALL_CASE_WITH_SYMBOLS, random_length=False, max_length=10, count=5)
print('Following are the generated random strings \n{}'.format('\n'.join(random_strings)))

## calling method to get a list of random string and forcing to use characters of each type
random_strings = py_random_string.get_strings(string_type=PyRandomString.StringType.ALPHA_NUMERIC_ALL_CASE_WITH_SYMBOLS, random_length=False, max_length=10, count=5, must_include_all_type=True)
print('Following are the generated random strings \n{}'.format('\n'.join(random_strings)))

Release files for pyrandomstring 0.0.6

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

Source distribution (sdist)

Source distribution for pyrandomstring 0.0.6
File Size Uploaded
pyrandomstring-0.0.6.tar.gz 5.4 kB Details

Built distribution (wheel)

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

Total release size: 11.9 kB

Release files / pyrandomstring-0.0.6.tar.gz

Download URL pyrandomstring-0.0.6.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
16deb3d1f47828c1bc48a1e7b825e37fc0f03181967fe1a2463f965999dec2e9
BLAKE2b-256 checksum
How to use checksums
251d20100efdb867777df276033c8e731f5e6bf74012f0df48ea3b2b885f2214
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Release files / pyrandomstring-0.0.6-py3-none-any.whl

Download URL pyrandomstring-0.0.6-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
268800643e4149ab14292bba73db9cb69e91b2ad38a562edc53d2d719c872894
BLAKE2b-256 checksum
How to use checksums
b9ce718dd8ddcc14589ba2528ccbca23b7145dc96cca6636e32a431effd0f5ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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