Esempio n. 1
0
            public bool TryAdvance(LongConsumer consumer)
            {
                if (consumer == null)
                {
                    throw new NullPointerException();
                }
                long i = Index, f = Fence;

                if (i < f)
                {
                    consumer.Accept(Rng.InternalNextLong(Origin, Bound));
                    Index = i + 1;
                    return(true);
                }
                return(false);
            }
Esempio n. 2
0
            public void ForEachRemaining(LongConsumer consumer)
            {
                if (consumer == null)
                {
                    throw new NullPointerException();
                }
                long i = Index, f = Fence;

                if (i < f)
                {
                    Index = f;
                    SplittableRandom r = Rng;
                    long             o = Origin, b = Bound;
                    do
                    {
                        consumer.Accept(r.InternalNextLong(o, b));
                    } while (++i < f);
                }
            }