app/src/main/java/com/example/bfs/DrawingTool/ResultIndividualDraw.java
// Function to build a prefix sum array of probabilities
Function to build a prefix sum array of probabilities
Function to build a prefix sum array of probabilities
ArrayList<Integer> makePrefixSumOfProb() {
        table.add(0, new Participant("", 0, 0));
        ArrayList<Integer> ps = new ArrayList<Integer>();
        ps.add(0);
        for(int i = 1; i < table.size(); i++) {
            int p = table.get(i).getProb();
            ps.add(ps.get(i-1) + p);
        }
        return ps;
    }
ArrayList < Integer > makePrefixSumOfProb ( ) { table . add ( 0 , new Participant ( "" , 0 , 0 ) ) ; ArrayList < Integer > ps = new ArrayList < Integer > ( ) ; ps . add ( 0 ) ; for ( int i = 1 ; i < table . size ( ) ; i ++ ) { int p = table . get ( i ) . getProb ( ) ; ps . add ( ps . get ( i - 1 ) + p ) ; } return ps ; }
Function to build a prefix sum array of probabilities
Function to build a prefix sum array of probabilities