title: Java Random Percentage Chance
body: <p>Someone can u help me to show how to make a probability / chance with percentage ?</p>
  <pre><code>import java.util.Random;
  
  public class Main {
  
      public static void main(String[] args) {
          int a = new Random().nextInt(10);
          if (a &gt;= 6) {
              // 60% chance
              System.out.println(a);
              System.out.println(&quot;You got a passive power&quot;);
          } else if (a &gt;= 3) {
              // 30% chance
              System.out.println(a);
              System.out.println(&quot;You got an active power&quot;);
          } else if (a &gt;= 1) {
              // 10% chance
              System.out.println(a);
              System.out.println(&quot;You got an ultimate power&quot;);
          } else {
              // &lt;10% chance (maybe)
              System.out.println(a);
              System.out.println(&quot;You blessed with all powers.&quot;);
          }
      }
  }
  </code></pre>
  <p>Is my program correct ?</p>
  <p><strong>Ty</strong></p>