random.uniform()


Definition
The uniform(a, b) method of random.Random instance Get a random number in the range [a, b) or [a, b] depending on rounding.

Syntax
random.uniform(a,b)

Parameters
a,b=range

Examples
The return is as:
 >>> random.uniform(12,11)
11.091181599814675
>>> 

int(round(operator.sub(a,b)))
The method returns with the for loop after finding the subtraction of random values.
import operator
import random
a=random.triangular(7,14)
b=random.uniform(2,5)
x=int(round(operator.sub(a,b)))
for i in range(x, 30):
    print(i)
    if i.__ge__(30):
        b=int(round(random.paretovariate(3)))
        print(i)

>>> 
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
>>>


Comments