Wrong with change python code to js

See here: Randomisation without consecutive presentations - #2 by Michael