Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Generate random float in Python

📅 2012-May-03 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

import random

# Random float in [0.0, 1.0)
a = random.random()

# Random float in [0, 100]
b = random.uniform( 0, 100 )