@@ -101,8 +101,7 @@ public static CBORObject RandomCBORTextString(FastRandom rand) {
101101
102102 public static CBORObject RandomCBORMap (FastRandom rand , int depth ) {
103103 int x = rand .NextValue (100 );
104- int count = 0 ;
105- count = (x < 80 ) ? 2 : ((x < 93 ) ? 1 : ((x < 98 ) ? 0 : 10 ));
104+ int count = (x < 80 ) ? 2 : ((x < 93 ) ? 1 : ((x < 98 ) ? 0 : 10 ));
106105 CBORObject cborRet = CBORObject .NewMap ();
107106 for (int i = 0 ; i < count ; ++i ) {
108107 CBORObject key = RandomCBORObject (rand , depth + 1 );
@@ -162,8 +161,7 @@ public static CBORObject RandomCBORTaggedObject(
162161
163162 public static CBORObject RandomCBORArray (FastRandom rand , int depth ) {
164163 int x = rand .NextValue (100 );
165- int count = 0 ;
166- count = (x < 80 ) ? 2 : ((x < 93 ) ? 1 : ((x < 98 ) ? 0 : 10 ));
164+ int count = (x < 80 ) ? 2 : ((x < 93 ) ? 1 : ((x < 98 ) ? 0 : 10 ));
167165 CBORObject cborRet = CBORObject .NewArray ();
168166 for (int i = 0 ; i < count ; ++i ) {
169167 cborRet .Add (RandomCBORObject (rand , depth + 1 ));
@@ -276,17 +274,18 @@ public static BigInteger RandomBigInteger(FastRandom r) {
276274 if (selection < 40 ) {
277275 StringAndBigInt sabi = StringAndBigInt .Generate (r , 16 );
278276 return sabi .getBigIntValue ();
279- } else if (selection < 50 ) {
277+ }
278+ if (selection < 50 ) {
280279 StringAndBigInt sabi = StringAndBigInt .Generate (r , 2 + r .NextValue (35 ));
281280 return sabi .getBigIntValue ();
282281 } else {
283- int count = r .NextValue (60 ) + 1 ;
284- byte [] bytes = new byte [count ];
285- for (int i = 0 ; i < count ; ++i ) {
286- bytes [i ] = (byte )((int )r .NextValue (256 ));
282+ int count = r .NextValue (60 ) + 1 ;
283+ byte [] bytes = new byte [count ];
284+ for (int i = 0 ; i < count ; ++i ) {
285+ bytes [i ] = (byte )((int )r .NextValue (256 ));
286+ }
287+ return BigInteger .fromByteArray (bytes , true );
287288 }
288- return BigInteger .fromByteArray (bytes , true );
289- }
290289 }
291290
292291 public static ExtendedFloat RandomExtendedFloat (FastRandom r ) {
0 commit comments