From d55d9bd600dcb4b388d340a8b0ef3dbf22a89303 Mon Sep 17 00:00:00 2001 From: TonCherAmi Date: Fri, 17 Dec 2021 11:22:51 +0300 Subject: [PATCH] Do not instantiate SecureRandom on every call (#58) --- .../ru/touchin/common/random/SecureRandomStringGenerator.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/kotlin/ru/touchin/common/random/SecureRandomStringGenerator.kt b/common/src/main/kotlin/ru/touchin/common/random/SecureRandomStringGenerator.kt index e5843ae..bf0a56c 100644 --- a/common/src/main/kotlin/ru/touchin/common/random/SecureRandomStringGenerator.kt +++ b/common/src/main/kotlin/ru/touchin/common/random/SecureRandomStringGenerator.kt @@ -24,6 +24,6 @@ object SecureRandomStringGenerator { } } - fun generateRandomBytes(size: Int) = ByteArray(size).also(SecureRandom()::nextBytes) + fun generateRandomBytes(size: Int) = ByteArray(size).also(secureRandom::nextBytes) }