[SOLVED] Jython: how to get random?


It seems I need the Random module to get randrange working, is there another way to get a “random” value from 1-10 ?
I’m playing some random xmas sounds (mp3’s defined in an array) on a trigger :wink:


1 Like

Yeah but it does not seem to be a part of jython?

Using “x = random.randint(1,10)” gives:
NameError: name ‘random’ is not defined in …

Using “x = randint(1,10)”
NameError: name ‘randint’ is not defined in …

Jython is Python 2.7…


1 Like

have you imported it at the top of the file?

import random
1 Like

Geez, you guys are fast. :smile: You are correct, I forgot to import :+1:


1 Like