More random utils
Project description
extrarandom
A library that provides extra utilities builtin on the builtin library random
.
Installation
pip install extrarandom
Methods
Random booleans
some_bool = randbool()
three_bools = randbools(3)
Random characters
letter = randletter()
uppercase = randuppercase()
lowercase = randlowercase()
Random hex
nine = hex(9)
twenty = hex(20)
sth_between_9_and_20 = randhex(nine, twenty) # returns a string just like hex()
Random string manipulation
mystring = "abcdef"
modified_string = strinsert(mystring, "HELLO")
# some possible outcomes:
# "abHELLOcdef", "HELLOabcdef", "abcdefHELLO", etc
# if you don't want the substring to be inserted at the start/end:
modified_string2 = strinsertin(mystring, "HELLO")
# impossible outcomes:
# "HELLOabcdef", "abcdefHELLO"
Random list manipulation
mylist = [1, 2, 3, 4]
listinsert(mylist, -999)
# some possible outcomes:
# [-999, 1, 2, 3, 4] [1, 2, -999, 3, 4] [1, 2, 3, 4, -999]
# listinsertin is similar to strinsertin
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
extrarandom-1.0.1.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for extrarandom-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d022ec42b0db5fce23d0ebf1b8919208ceeaddfd2be721b1b40bf28a4b75b82 |
|
MD5 | a3200028b9489fffbb077eb4dee8e19f |
|
BLAKE2b-256 | 22d25b6de458b05f5f2c9b380b2f78d218a4dd2530ad32c6d18c97fbebeacba2 |