Revision as of 06:46, 4 December 2010 by Han84 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
/**
 * 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

Ph.D. 2007, working on developing cool imaging technologies for digital cameras, camera phones, and video surveillance cameras.

Buyue Zhang