import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

class Main
{
	static class RandomMethod {
        private final Runnable method;
        private final int chance;

        RandomMethod(Runnable method, int chance){
            this.method = method;
            this.chance = chance;
        }

        public int getChance() { return chance; }
        public void run() { method.run(); }
    }
    
    static class MethodChooser {
        private final List<RandomMethod> methods;
        private final int total;

        MethodChooser(final List<RandomMethod> methods) {
            this.methods = methods;
            this.total = methods.stream().collect(Collectors.summingInt(RandomMethod::getChance));
        }

        public void chooseMethod() {
            final Random random = new Random();
            final int choice = random.nextInt(total);

            int count = 0;
            for (final RandomMethod method : methods)
            {
                count += method.getChance();
                if (choice < count) {
                    method.run();
                    return;
                }
            }
        }
    }
	
    private static void aaa() { System.out.println("a"); }
    private static void bbb() { System.out.println("b"); }
    private static void ccc() { System.out.println("c"); }

    public static void main(String[] args) {
        MethodChooser chooser = new MethodChooser(Arrays.asList(
            new RandomMethod(Main::aaa, 1),
            new RandomMethod(Main::bbb, 3),
            new RandomMethod(Main::ccc, 1)
        ));

        IntStream.range(0, 100).forEach(
            i -> chooser.chooseMethod()
        );
    }
}