Adds groupRandomly and shard to TypedPipe

closes #512