File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/internal Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
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
+ return result ;
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments