#Python, 36 bytes#

<!-- language-all: lang-python -->

    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