2929
3030using System ;
3131using System . Collections . Generic ;
32- using System . Numerics ;
33- using System . Linq ;
3432
3533namespace MathNet . Numerics . Random
3634{
@@ -169,7 +167,7 @@ public static void NextInt32s(this System.Random rnd, int[] values, int minInclu
169167 }
170168
171169 /// <summary>
172- /// Returns an infinite sequence of uniform random 32-bit signed integers within the specified range .
170+ /// Returns an infinite sequence of uniform random numbers greater than or equal to 0.0 and less than 1.0 .
173171 /// </summary>
174172 /// <remarks>
175173 /// This extension is thread-safe if and only if called on an random number
@@ -193,34 +191,6 @@ static IEnumerable<int> NextInt32SequenceEnumerable(System.Random rnd, int minIn
193191 }
194192 }
195193
196- /// <summary>
197- /// Returns an infinite sequence of uniform random <see cref="System.Numerics.BigInteger"/> within the specified range.
198- /// </summary>
199- /// <remarks>
200- /// This extension is thread-safe if and only if called on an random number
201- /// generator provided by Math.NET Numerics or derived from the RandomSource class.
202- /// </remarks>
203- public static IEnumerable < BigInteger > NextBigIntegerSequence ( this System . Random rnd , BigInteger minInclusive , BigInteger maxExclusive )
204- {
205- BigInteger AbsoluteRange = maxExclusive - minInclusive ;
206- int NumBytes = ( int ) Math . Ceiling ( BigInteger . Log ( AbsoluteRange , byte . MaxValue ) * 2 ) ;
207- byte [ ] ByteSequence = Enumerable . Repeat ( byte . MaxValue , NumBytes + 1 ) . ToArray ( ) ;
208- ByteSequence [ NumBytes ] = 0 ;
209- BigInteger RandomNumber = new BigInteger ( ByteSequence ) ;
210- BigInteger ValidRange = RandomNumber - RandomNumber % AbsoluteRange ;
211- while ( true )
212- {
213- do
214- {
215- rnd . NextBytes ( ByteSequence ) ;
216- ByteSequence [ NumBytes ] = 0 ;
217- RandomNumber = new BigInteger ( ByteSequence ) ;
218- }
219- while ( RandomNumber >= ValidRange ) ;
220- yield return RandomNumber % AbsoluteRange + minInclusive ;
221- }
222- }
223-
224194 /// <summary>
225195 /// Returns a nonnegative random number less than <see cref="Int64.MaxValue"/>.
226196 /// </summary>
0 commit comments