Randomizing arrays
To randomize an array in javascript there is this way:
a = [1,2,3,4,5] a.sort(function() {return .5 - Math.random()});
In Python you can you shuffle from the random module
from random import shuffle a = [1,2,3,4,5] shuffle(a)
Python, Pygame and Tkinter with free tutorials – on twitter I'm @pythonprogrammi on youtube GiovanniPython
To randomize an array in javascript there is this way:
a = [1,2,3,4,5] a.sort(function() {return .5 - Math.random()});
In Python you can you shuffle from the random module
from random import shuffle a = [1,2,3,4,5] shuffle(a)
Seamless Theme René, made by Altervista
Create a website and earn with Altervista - Disclaimer - Report Abuse - Privacy Policy - Customize advertising tracking