/** * Apply uniform error. * @param stream * @param lossRate it ranges from 0.0 to 1.0 * @param seed */ public static void fecUniformError(byte[] stream, double lossRate, int seed) { byte lossValue = 0; java.util.Random local_r = new java.util.Random(seed); for (int i = 0; i < stream.length; i++) { if (local_r.nextDouble() < lossRate) { stream[i] = lossValue; } } }