/******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
public class Main
{
public static void main(String[] args) {
double chance = 90; // Шанс заточки
int itemCount = 100; //Количество итемов для заточки
int b = 0;
for(int a = 0; a < itemCount; a++) {
double rnd = Math.random();
if(rnd <= (chance / 100)) {
b++;
System.out.println("Success: " + " Num item: " + (a + 1));
}
}
System.out.println("Item enchant success: " + b);
}
}