randRange( 0, 127 ) randFromArray(["even", "odd"]) to7BitString(Dec)

In an Parity parity scheme what would the parity bit be for the binary string Bits?

getParityBit( Bits, Parity )

There are countOnes(Bits, Parity) bits that are 1s in Bits.

The parity is Parity and the string has countOnes(Bits,Parity) bits that are 1s.

You should add a getParityBit( Bits, Parity) as the parity bit giving getParityBit( Bits, Parity) + Bits which has an Parity number of 1s.