Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class VS {
- public static void main(String[] args) {
- int povp = 0;
- int[] stevila = new int[30];
- for (int j = 0; j < 30; j++) {
- boolean[] karte = new boolean[52];
- int count = 0;
- boolean all = true;
- while (all) {
- karte[(int) (Math.random() * 52)] = true;
- all = false;
- for (int i = 0; i < 52; i++) {
- if (!karte[i]) {
- all = true;
- break;
- }
- }
- count++;
- }
- System.out.print(count);
- if (j != 29) {
- System.out.print(", ");
- }
- povp += count;
- stevila[j] = count;
- }
- System.out.println();
- povp = Math.round(povp/30);
- System.out.println("Povprecje: " + povp);
- int sest = 0;
- for (int i = 0; i < 30; i++) {
- sest += Math.pow(stevila[i]-povp,2);
- }
- double nov = Math.round(Math.sqrt(sest/29));
- System.out.println("Ocena odklona: " + nov);
- nov = (1.96*nov)/Math.sqrt(30);
- System.out.println("Delta: " + nov);
- System.out.println("spodnja: " + (Math.round((povp - nov)*100))/100.);
- System.out.println("zgornja: " + (Math.round((povp + nov)*100))/100.);
- }
- }
Add Comment
Please, Sign In to add comment