Skip to main content
3 of 6
update
DuhHello
  • 499
  • 1
  • 4
  • 5

#Python, 36 bytes#

import random
lambda n:1>random.random()*n

50 bytes if function is named:

import random
def f(n):return 1>random.random()*n

Edit: Using the current time instead of random.random(), seven bytes are saved:

import time
lambda n:1>time.time()%n
DuhHello
  • 499
  • 1
  • 4
  • 5