We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 89d864e commit f87cf5aCopy full SHA for f87cf5a
src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/internal/Utils.java
@@ -0,0 +1,28 @@
1
+package com.amazonaws.services.dynamodbv2.datamodeling.internal;
2
+
3
+import java.security.SecureRandom;
4
5
+public class Utils {
6
+ private static final ThreadLocal<SecureRandom> RND = new ThreadLocal<SecureRandom>() {
7
+ @Override
8
+ protected SecureRandom initialValue() {
9
+ final SecureRandom result = new SecureRandom();
10
+ result.nextBoolean(); // Force seeding
11
+ return result;
12
+ }
13
+ };
14
15
+ private Utils() {
16
+ // Prevent instantiation
17
18
19
+ public static SecureRandom getRng() {
20
+ return RND.get();
21
22
23
+ public static byte[] getRandom(int len) {
24
+ final byte[] result = new byte[len];
25
+ getRng().nextBytes(result);
26
27
28
+}
0 commit comments