Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

prog challenge

Name: Anonymous 2010-09-13 8:38

Create a sequence of random integers with the following given: max, average, length

Example, with m = 7, a = 4, l = 5, you get [ 5, 2, 2, 4, 7 ].

Name: Anonymous 2010-09-16 9:52


def stupid_prague_challenge(m, a, l):
    from random import randint
    while True:
        r = [randint(1, m) for k in range(l)]
        if (sum(r) / l) == a:
            return r

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List