diff options
Diffstat (limited to 'crypto/src/pqc/math/linearalgebra/RandUtils.cs')
-rw-r--r-- | crypto/src/pqc/math/linearalgebra/RandUtils.cs | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/crypto/src/pqc/math/linearalgebra/RandUtils.cs b/crypto/src/pqc/math/linearalgebra/RandUtils.cs deleted file mode 100644 index f7b7b8588..000000000 --- a/crypto/src/pqc/math/linearalgebra/RandUtils.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Org.BouncyCastle.Security; - -namespace Org.BouncyCastle.Pqc.Math.LinearAlgebra -{ - public class RandUtils - { - public static int NextInt(SecureRandom rand, int n) - { - - if ((n & -n) == n) // i.e., n is a power of 2 - { - return (int)((n * (long)(Utils.UnsignedRightBitShiftInt(rand.NextInt(), 1))) >> 31); - } - - int bits, value; - do - { - bits = Utils.UnsignedRightBitShiftInt(rand.NextInt() ,1); - value = bits % n; - } - while (bits - value + (n - 1) < 0); - - return value; - } - } - -} |