asiftasleem / nbuilder

Automatically exported from code.google.com/p/nbuilder
0 stars 0 forks source link

UniqueRandomGenerator fails (no more values) with doubles (decimal, float, etc) even though range should be practically infinite #66

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. var generator = new UniqueRandomGenerator();
2. generator.Next(0.0, 1);
3. generator.Next(0.0, 1);

What is the expected output? What do you see instead?
The second call to generator.Next(0.0, 1) should return a unique value between 
0.0 and 1.0 (of which there are a very large number). Instead, we get an 
InvalidOperationException because "There are no more unique values available".

What version of the product are you using? On what operating system?
r53. Windows 7.

Please provide any additional information below.
The methods that call NextUnique with double, decimal, or float values need to 
have their rangeSize calculated differently. For those values, it might be 
easier to just put in a timeout (e.g. if the next unique value isn't found 
within 30s, throw new TimeoutException).

Original issue reported on code.google.com by pckuj...@gmail.com on 25 Feb 2011 at 5:38