Commit f2c21102 authored by jerry73204's avatar jerry73204 Committed by Jeffrey I. Schiller

Use built-in (rejection algorithm) random sampling

The original method, uniform integer modulo 100000, is biased in
distribution. Now it's replaced by built-in sampling method.

Java 7 API has comments on random.nextInt(int n):
https://docs.oracle.com/javase/7/docs/api/java/util/Random.html#nextInt(int)
parent 7c0d6677
......@@ -141,7 +141,7 @@ public class WebRTCNativeMgr {
Log.d(LOG_TAG, "IceCandidate = " + iceCandidate.toString());
/* Send to Peer */
JSONObject response = new JSONObject();
response.put("nonce", random.nextInt() % 100000);
response.put("nonce", random.nextInt(100000));
JSONObject jsonCandidate = new JSONObject();
jsonCandidate.put("candidate", iceCandidate.sdp);
jsonCandidate.put("sdpMLineIndex", iceCandidate.sdpMLineIndex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment