// Shuffle takes a (private) seed and a (possibly public) label and produces a random shuffle of the integers [0, 16). func (rs *RandomSource) Shuffle(label []byte) encoding.Shuffle { key := [16]byte{} copy(key[:], label) cached, ok := rs.encodingCache[key] if ok { return cached } else { rs.encodingCache[key] = encoding.GenerateShuffle(rs.Stream(label)) return rs.encodingCache[key] } }
func getShuffle(seed, label []byte) encoding.Shuffle { key := [32]byte{} copy(key[0:16], seed) copy(key[16:32], label) cached, ok := encodingCache[key] if ok { return cached } else { encodingCache[key] = encoding.GenerateShuffle(generateStream(seed, label)) return encodingCache[key] } }