/**
 * 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;
		}
	}
}


Back to JavaHowTo

Alumni Liaison

has a message for current ECE438 students.

Sean Hu, ECE PhD 2009