Aller au contenu
View in the app

A better way to browse. Learn more.

Forum de Frandroid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Fonction de hasard

Featured Replies

Posté(e)

Bonjour je souhaite faire une app de hasard qui fait appel a ces fonctions, hors je vois bien que les proportions de sont pas egales, voici mon code :

 

je definiss lower et higher plus haut en fonction du nombre de choix (ici 0 et 100 pour 2 choix, 0 et 300 pour 2 choix et 0 et 400 pour 4 choix)

 

 

 

public String multiChoix() {

String monChoix = "";
int alea;

alea = rand.nextInt(higher - lower +1) + lower ;

if (nbC == 2)
{
String deux = ouiOuNon();
if (deux=="OUI"){monChoix=c1;}
else if (deux=="NON"){monChoix=c2;}
/*
if (alea<=49)
{
monChoix =c1 ;
}
else if (alea>49)
{
monChoix = c2 ;
}
*/
}
else if (nbC == 3)
{
if (alea<=99)
{
monChoix = c1 ;
}
else if (alea<=199)
{
monChoix = c2 ;
}
else if (alea>=200)
{
monChoix = c3 ;
}
}
else if (nbC == 4)
{
if (alea<=99)
{
monChoix = c1 ;
}
else if (alea<=199)
{
monChoix = c2 ;
}
else if (alea<=299)
{
monChoix = c3 ;
}
else if (alea>=300)
{
monChoix = c4 ;
}
}
else { monChoix = "nbC :(" ; }

return monChoix ;
}

 

 

Pouvais vous me dire si cela fonctionnne normalement ?

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

Account

Navigation

Rechercher

Rechercher

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.