Skip to content

Commit

Permalink
csharp
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-aws committed Nov 7, 2023
1 parent 39ceb39 commit b3b4a1e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/interop/cs/DRandomUniformPowerOfTwo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ namespace UniformPowerOfTwo_mImplementation {
public class DRandomUniformPowerOfTwo : Coin_mInterface.DRandomCoin {

/// Generates a uniformly random BigInteger between 0 (inclusive) and 2^bitLength (exclusive)
private static BigInteger UniformPowerOfTwo(int bitLength) {
private static BigInteger UniformPowerOfTwo(BigInteger n) {
if (n <= BigInteger.Zero) {
throw new ArgumentException("n must be positive");
}

int bitLength = System.Convert.ToInt32(n.GetBitLength());

if (bitLength < 1) {
return BigInteger.Zero;
}
Expand Down

0 comments on commit b3b4a1e

Please sign in to comment.