class BasicMoleculeHashGenerator implements MoleculeHashGenerator {

    @Override
    public long generate(IAtomContainer container) {

        long[] hashes = generator.generate(container);
        long[] rotated = new long[hashes.length];

        Arrays.sort(hashes);

        // seed with Mersenne prime 2^31-1
        long hash = 2147483647L;

        for (int i = 0; i < hashes.length; i++) {

            // if non-unique, then get the next random number
            if (i > 0 && hashes[i] == hashes[i - 1]) {
                hash ^= rotated[i] = pseudorandom.next(rotated[i - 1]);
            } else {
                hash ^= rotated[i] = hashes[i];
            }
        }

        return hash;
    }

    public  BasicMoleculeHashGenerator(AtomHashGenerator generator);
      BasicMoleculeHashGenerator(AtomHashGenerator generator, Pseudorandom pseudorandom);

}