Search code examples
pythonskulpt

random.sample in Skulpt?


Using Skulpt I want to generate a random list of 5 numbers from the range 0 to 50. This is the code I'm using:

import random
print(random.sample(range(50), 5))

but it doesn't run.

Any tips?


Solution

  • I don't know why it didn't :) but it does now:

    ➜  skulpt git:(master) ✗ ./m run rand.py 
    [40, 44, 23, 36, 42]
    -----
    ➜  skulpt git:(master) ✗ cat rand.py 
    import random
    print(random.sample(range(50), 5))