Randomize color choice both JS and Python

Hi everyone,

I am having a problem randomizing colors for my experiment. I currently have the following code

import random
dur = 0
opa = 0
colorList = [“red”, “orange”, “yellow”, “green”, “blue”, “purple”]
color = random.choice(colorList)

This works well on my laptop, however, the import random function does not work in JS, so my experiment doesn’t work online. Does anyone have a suggestion on how to combat this?

Thank you,
Elise

dur = 0
opa = 0
colorList = [“red”, “orange”, “yellow”, “green”, “blue”, “purple”]
shuffle(colorList)
color = colorList[0]