A voir également:
- Maple: tirage aléatoire de 5 numéros distinct
- Maple - Télécharger - Gestion de données
- Maple professional - Télécharger - Agendas & Calendriers
3 réponses
Templier Nocturne
Messages postés
7734
Date d'inscription
jeudi 22 janvier 2009
Statut
Membre
Dernière intervention
21 mai 2016
1 101
28 mai 2012 à 15:23
28 mai 2012 à 15:23
je connais pas Maple, mais sur d'autres langages, on peut faire comme ça :
a = rand(1,49)
b = rand(1,49)
while(a == b)
{
b = rand(1,49)
}
c = rand(1,49)
while(c == b || c == a)
{
c = rand(1,49)
}
et ainsi de suite
a = rand(1,49)
b = rand(1,49)
while(a == b)
{
b = rand(1,49)
}
c = rand(1,49)
while(c == b || c == a)
{
c = rand(1,49)
}
et ainsi de suite
Bon voila j'en avais marre de chercher donc j'ai fait un truc qui marche à peu près (sauf si malheuresement le numéro en double est le 49). Si ça peut etre utile à quelqu'un;
il suffit alors de taper H(5)
restart: > roll:=rand(1..49): > H:=proc(n) local a,j,L; > a:=sort([roll(),roll(),roll(),roll(),roll()]); > L:=a[1]; > for j from 2 to n do > if a[j]>a[j-1] then L:=L,a[j]; > else L:=L,a[j]+1; fi; od; L; end proc;
il suffit alors de taper H(5)