Add datastructure class RandomGrabHashSet


- I had written this for WOT originally. It is very generic so toad asked me to add it to Fred.
- Notice that it is not duplication of RandomGrabArray: RandomGrabArray is very tightly wired in to non-generic Fred code. RandomGrabHashSet is a naked datastructure which doesn't depend on Fred at all.

In general I agree with you, but in this case the implementation is rather
trivial and well-readable and the corner cases are easy to understand. If
you insist, pick just a few numbers by hand and test with those for "normal
operation".
Op 12 jun. 2014 18:45 schreef "Ximin Luo" <notifications@github.com>:

> In test/freenet/support/RandomGrabHashSetTest.java:
>
> > +
> > +/**
> > + * @author xor (xor@freenetproject.org)
> > + */
> > +public final class RandomGrabHashSetTest extends TestCase {
> > +
> > +    Random random;
> > +    RandomGrabHashSet<Integer> set;
> > +    Integer element1;
> > +    Integer element2;
> > +
> > +    protected final void setUp() throws Exception {
> > +        super.setUp();
> > +
> > +        random = new Random();
> > +        final long seed = random.nextLong();
>
> There's nothing wrong with using randomly-generated values in tests,
> especially if they are repeatable with a known seed. It can be quite handy
> to catch issues you didn't originally think of.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/freenet/fred-staging/pull/198/files#r13712073>.
>