zufällig zwischen zwei Schwimmern Python
>>> random.uniform(1.5, 1.9)
1.8733202628557872
Horrible Hornet
>>> random.uniform(1.5, 1.9)
1.8733202628557872
import random
# generates completely random number
x = random.random()
# generates a random int
x = random.randint()
# generates a random int in a range
x = random.randint(1, 100)
# NOTE: RANGE DOESN'T WORK FOR random.random()
# imports random
import random
# randint generates a random integar between the first parameter and the second
print(random.randint(1, 100))
# To create a list of random float numbers:
import numpy
random_float_array = numpy.random.uniform(75.5, 125.5, 2)
# Output:
# [107.50697835, 123.84889979]
from random import randint
print(randint(1,3))
#Possible Outputs#
#1
#2
#3
from random import randrange
print(randrange(10))