From 042d0ea23ae3e954c9b5dfa98a7a1dc21fbbdb50 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 23 Nov 2017 13:08:20 +0100 Subject: [PATCH] better random --- src/main/java/com/owncloud/android/utils/EncryptionUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/owncloud/android/utils/EncryptionUtils.java b/src/main/java/com/owncloud/android/utils/EncryptionUtils.java index 78041679a1..8c1db68b02 100644 --- a/src/main/java/com/owncloud/android/utils/EncryptionUtils.java +++ b/src/main/java/com/owncloud/android/utils/EncryptionUtils.java @@ -72,6 +72,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import java.util.Random; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; @@ -597,7 +598,7 @@ public class EncryptionUtils { ArrayList outputLines = new ArrayList<>(); for (int i = 0; i < count; i++) { - int randomLine = (int) (random.nextDouble() * lines.size()); + int randomLine = new Random().nextInt(lines.size()); outputLines.add(lines.get(randomLine)); }