generate functionTue, 07 Mar 2023

print a random number in the range from 0 to n where n is a fractional number. The output number has twelve decimal places.

def random_number(n): return "{:.12f}".format(random.random() * n)

Questions about programming?Chat with your personal AI assistant