Aléatoire avec probabilités (python)
Résolu
A voir également:
- Aléatoire avec probabilités (python)
- Citizen code python - Guide
- Python est introuvable. exúcutez sans argument pour procúder ó l - Forum Python
- Python retour à la ligne dans le code - Forum Python
- Compris entre python ✓ - Forum Python
- Lancer script python linux - Forum Ubuntu
2 réponses
hypothetix
Messages postés
160
Date d'inscription
dimanche 19 janvier 2020
Statut
Membre
Dernière intervention
20 septembre 2023
45
29 sept. 2022 à 20:38
29 sept. 2022 à 20:38
Bonsoir,
import random tableau = [0, 1, 2, 3] print(random.choices(tableau, weights=(10, 15, 25, 50), k=10))
29 sept. 2022 à 20:46
Ah oui, bien mieux, trop peu usitée cette fonction.