randomUtil.py 536 Bytes
Newer Older
zhaihuitao committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# -*- coding: utf-8 -*-
"""
@author:zhaiht
@file:  randomUtil.py
@time:  2020/8/7 15:23
@desc:
"""

import struct
import socket
import random


class randomUtil:
zhaihuitao committed
15

zhaihuitao committed
16 17 18 19 20 21 22 23
    def randip(self):
        ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
        return ip

    def randimei(self):
        i = ''.join(str(random.choice(range(10))) for _ in range(12))
        return i

zhaihuitao committed
24 25 26
    def transactionid(self):
        t = ''.join(str(random.choice(range(10))) for _ in range(19))
        return t
zhaihuitao committed
27
r = randomUtil()