<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stochastic_choice(machines):
 """Stochastically choose one random machine distributed along their scores."""

    if len(machines) < 4:
        return random.choice(machines)

    r = random.random()
    if r < 0.5:
        return random.choice(machines[:len(machines)/4])
    elif r < 0.75:
        return random.choice(machines[:len(machines)/2])
    else:
        return random.choice(machines)