« Module:Aléa » : différence entre les versions

Contenu supprimé Contenu ajouté
rédaction
rédaction
Ligne 25 :
math.randomseed(temps)
return math.random(nombre)
end
 
function p.choix_rythme()
local rythmes = mw.loadData('Module:Lilypond')
local nombre = 0
while rythmes[nombre + 1] do -- Compte le nombre de rythmes dans le tableau
nombre = nombre + 1
end
local temps,index = 1,1
temps = os.clock()
index = (7^2 + 3)^2
temps = os.clock() - temps
temps = temps*100000000
math.randomseed(temps)
index = math.random(nombre) -- Détermine un index au hasard
return rythmes[index] -- Retourne le rythme correspondant
end