Add tlmConfirm to tlm_dl ota packet-structure (#2991)
[ExpressLRS.git] / src / python / randgentext_hopseq.py
blob1a79eb093b189c29a3608f118a003fc24e25e038
1 import random
2 import matplotlib.pyplot as plt
3 import math
5 X = []
6 length = 256
8 n = 20
9 limit = math.floor(length/n)
10 print(limit)
12 prev_val = 0
13 rand = 0
15 last_zero = 0
16 last_zero_interval = n
18 tracker = [0 for x in range(n+1)]
20 for i in range(0,length):
22 if(i >= last_zero + last_zero_interval):
23 rand = 0
24 last_zero = i
26 else:
28 while(prev_val == rand or tracker[rand] >= limit or rand > n):
29 rand = random.randint(1,n)
32 X.append(rand)
33 print(0)
34 tracker[rand] = tracker[rand] + 1
35 prev_val = rand
37 print(X)
39 plt.hist(X, bins=n+1) # arguments are passed to np.histogram
40 plt.show()