Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brennerm/randompy
Collection of functions to generate pseudo random values for emails, IP addresses, ...
https://github.com/brennerm/randompy
generator python random
Last synced: about 2 months ago
JSON representation
Collection of functions to generate pseudo random values for emails, IP addresses, ...
- Host: GitHub
- URL: https://github.com/brennerm/randompy
- Owner: brennerm
- License: mit
- Created: 2015-10-29T20:24:41.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-14T06:26:43.000Z (over 7 years ago)
- Last Synced: 2024-11-13T03:51:54.401Z (about 2 months ago)
- Topics: generator, python, random
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 8
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# randompy
### Installation
- From source
```
git clone https://github.com/brennerm/randompy
cd randompy
sudo python3 setup.py install
```
- With pip
```
pip install randompy
```
### Example use#### String
```
>>> randompy.string(10)
'iDa7FZl7rW'
```
#### Integer
```
>>> randompy.integer(0, 100)
15
```
#### Array
```
>>> randompy.array('123456789', 5)
['7', '5', '9', '3', '2']
```
#### Datetime
```
datetime.datetime(2016, 5, 24, 16, 34, 2, 726892)
>>> randompy.datetime(
... start=datetime.datetime(year=2016, month=1, day=1),
... end=datetime.datetime(year=2016, month=12, day=31))
datetime.datetime(2016, 2, 13, 21, 34, 58, 268978)
```#### Mail Address
```
>>> randompy.mail()
'[email protected]'
```#### MAC Address
```
>>> randompy.mac_address()
'fe:23:1d:1d:ec:be'
```
It's also possible to define an own prefix.
```
>>> randompy.mac_address('02:00:00')
'02:00:00:84:62:3e'>>> mac_address('02:00:00:00:00')
'02:00:00:00:00:63'
```#### IPv4 Address
```
>>> randompy.ipv4address()
'108.146.211.120'
```#### IPv6 Address
```
>>> randompy.ipv6address()
'7dd7:c3ee:b1b6:ba15:6bb6:c908:541a:efe4'
```