Générer plusieurs nombres aléatoires entre deux bornes
Résolu/Fermé
lmc-3
Messages postés
591
Date d'inscription
samedi 13 juin 2015
Statut
Membre
Dernière intervention
11 avril 2024
-
4 sept. 2015 à 18:37
lmc-3 Messages postés 591 Date d'inscription samedi 13 juin 2015 Statut Membre Dernière intervention 11 avril 2024 - 5 sept. 2015 à 16:43
lmc-3 Messages postés 591 Date d'inscription samedi 13 juin 2015 Statut Membre Dernière intervention 11 avril 2024 - 5 sept. 2015 à 16:43
A voir également:
- C++ nombre aléatoire entre deux bornes
- Un ecouteur sur deux marche ✓ - Forum Audio
- En raison d'un nombre important d'échec de connexion snapchat ✓ - Forum Snapchat
- Deux comptes whatsapp - Guide
- J'ai deux compte facebook avec la meme adresse mail ✓ - Forum Facebook
- Excel valeur comprise entre deux bornes - Forum Excel
2 réponses
lmc-3
Messages postés
591
Date d'inscription
samedi 13 juin 2015
Statut
Membre
Dernière intervention
11 avril 2024
67
Modifié par lmc-3 le 5/09/2015 à 16:54
Modifié par lmc-3 le 5/09/2015 à 16:54
J'ai trouvé plus simple merci:
if (TypeDe ==4)
{
int Resultat1 = 0;
int Resultat2 = 0;
srand(time(NULL));
Resultat1 = 1+rand() % (4 + 1);
Resultat2 = 1+rand() % (4 + 1);
int ResultatTot = Resultat1 + Resultat2 + Bonus;
printf ("\n\n %d + %d + %d = %d PV\n\n\n", Resultat1, Resultat2, Bonus, ResultatTot);
if (TypeDe ==4)
{
int Resultat1 = 0;
int Resultat2 = 0;
srand(time(NULL));
Resultat1 = 1+rand() % (4 + 1);
Resultat2 = 1+rand() % (4 + 1);
int ResultatTot = Resultat1 + Resultat2 + Bonus;
printf ("\n\n %d + %d + %d = %d PV\n\n\n", Resultat1, Resultat2, Bonus, ResultatTot);