import Random from '../../../core/util/Random' ; import BitSet from '../../../core/util/BitSet' ; param received param howMany param random param max export function corrupt ( received , howMany , random , max ) { const corrupted = new Map < number , boolean > ( ) ; for ( let j = 0 ; j < howMany ; j ++ ) { const location = random . next ( received . length ) ; const value = random . next ( max ) ; if ( corrupted . get ( location ) === true || received [ location ] === value ) { j -- ; } else { corrupted . set ( location , true ) ; received [ location ] = value ; } } }