Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Probability;
- import java.util.Random;
- public class Probability {
- int los=0;
- int max=5;
- int licznik=0;
- Random generator = new Random();
- Probability() {}
- void main(String[] args) {
- int cel = generator.nextInt( max );
- do {
- los = generator.nextInt( max );
- licznik++;
- } while (los != cel);
- System.out.println("Dana liczbe trafiono za " + licznik + " razem (sposrod " + licznik + ").");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement