Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import math
- import numpy as np
- from collections import deque
- import matplotlib.pyplot as plt
- from matplotlib import mlab
- def digits2number(digits):
- return int(''.join([str(d) for d in digits]))
- X = []
- for i in range (10000):
- unic_digits = deque(range(0, 10))
- num_len = 1 + math.floor(math.log(random.randint(1, 10000), 10))
- random.shuffle(unic_digits)
- if (unic_digits[0] == 0):
- unic_digits.rotate(1)
- X.append(digits2number(list(unic_digits)[:int(num_len)]))
- plt.hist(X, 100, histtype='step', cumulative=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement