Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: use SecureRandom instead of Random to reduce the chance of auto…
…-id collisions (#156)
  • Loading branch information
dconeybe committed Mar 27, 2020
1 parent 7d6c2c1 commit 0088ee7
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -41,6 +41,7 @@
import io.opencensus.trace.Span;
import io.opencensus.trace.Tracer;
import io.opencensus.trace.Tracing;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand All @@ -57,7 +58,7 @@
*/
class FirestoreImpl implements Firestore {

private static final Random RANDOM = new Random();
private static final Random RANDOM = new SecureRandom();
private static final int AUTO_ID_LENGTH = 20;
private static final String AUTO_ID_ALPHABET =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
Expand Down

0 comments on commit 0088ee7

Please sign in to comment.