class DiscreteRandomProducer extends RandomProducerWithGenerator {

    @Override public Double get() {
        double p = generator().nextDouble();
        for (int i = 0; i < probs.length; i++) {
            if (probs[i] > p)
                return (double)ids[i];
        }

        return (double)ids[probs.length - 1];
    }

    public  DiscreteRandomProducer(double... probs);
    public  DiscreteRandomProducer(long seed, double... probs);

}