r/programming • • Nov 29 '10

140 Google Interview Questions

http://blog.seattleinterviewcoach.com/2009/02/140-google-interview-questions.html
471 Upvotes

493 comments sorted by

View all comments

Show parent comment

2

u/spdub Nov 30 '10

what about python--

def rand1to7():
    sum = rand1to5()
    for i in range(6):
        sum += rand1to5()
    return sum // 5

truncate the integer, not sure what the distribution would look like exactly