Generating random sample with random.random in python
Question: I'd like to generate a sample size of 100 random numbers between 0 and 1 using
the random.random function.

    
    
    import random
    sample = [random.random for x in range(100)]
    

For instance, `while print(len(sample))` gives me 100, `print(sample[1])`
returns just a reference to the random object() instead of the actual random
number, which is what I want.

Why is this not working for me?

Probably basic, but I couldn't find an answer.


Answer: You are not calling the method:

    
    
    [random.random() for x in range(100)]
                  ^^
    

