Thanks for quick reply, Bruce!
Why I mean Vpython and not python is because in python I only need 3 lines to perform a random choice:
import random
a = [1,9,3,2]
print(random.choice(a))
and in web version of GlowScripts/Vpython (unfortunately I didn't understand all the difference between them yet) I cannot import random module. But I understood from documentation that some parts of it is already there. Maybe I got it wrong and they (...uniform,
choice, shuffle) can be used only on local computer with RapydScript-NG or or else installed. And if so, I probably have to implement my own version of the random functions, something like
L1 = [2, 3, 9, 1]
bucket = 0
threshold = 100/len(L1)
Zone = []
for i in range(len(L1)):
Zone.append(bucket+threshold)
bucket += threshold
rnd = int(random()*100)
print(rnd)
for i in:...
but isn't it easier to just add this module into code of GlowScript or Vpython? (I'm sorry, I'm not familiar with the complexity of such task yet).
четверг, 14 января 2021 г. в 00:10:45 UTC+2, Bruce Sherwood: