Closed colgreen closed 3 years ago
I have added PR with XorShiftRandomRandomization and Xoshiro256StarStarRandomRandomization, benchmark results on my machine (Windows, i7-7700HQ).
Method | Mean | Error | StdDev | Ratio | RatioSD | Rank |
---|---|---|---|---|---|---|
Basic_GetDouble | 33.76 ns | 0.7055 ns | 1.0118 ns | 1.92 | 0.09 | 7 |
Basic_GetEvenInt | 43.73 ns | 0.8210 ns | 0.7278 ns | 2.47 | 0.09 | 10 |
Basic_GetFloat | 30.50 ns | 0.6444 ns | 0.7671 ns | 1.74 | 0.07 | 6 |
Basic_GetInt | 34.84 ns | 0.6980 ns | 0.6529 ns | 1.97 | 0.08 | 7 |
Basic_GetInts | 366.92 ns | 5.2352 ns | 4.8970 ns | 20.79 | 0.82 | 16 |
Basic_GetOddInt | 50.03 ns | 0.5213 ns | 0.4877 ns | 2.83 | 0.10 | 11 |
Basic_GetUniqueInts | 1,523.69 ns | 30.2492 ns | 29.7087 ns | 86.53 | 3.36 | 20 |
FastRandom_GetDouble | 17.58 ns | 0.3874 ns | 0.5172 ns | 1.00 | 0.00 | 2 |
FastRandom_GetEvenInt | 32.99 ns | 0.6831 ns | 0.6389 ns | 1.87 | 0.07 | 7 |
FastRandom_GetFloat | 18.50 ns | 0.3221 ns | 0.3013 ns | 1.05 | 0.04 | 3 |
FastRandom_GetInt | 19.07 ns | 0.4110 ns | 0.5048 ns | 1.09 | 0.05 | 4 |
FastRandom_GetInts | 216.03 ns | 4.3450 ns | 7.0164 ns | 12.31 | 0.49 | 13 |
FastRandom_GetOddInt | 33.34 ns | 0.5370 ns | 0.4760 ns | 1.88 | 0.06 | 7 |
FastRandom_GetUniqueInts | 1,311.71 ns | 20.3909 ns | 19.0737 ns | 74.31 | 2.69 | 17 |
XorShiftRandom_GetDouble | 16.61 ns | 0.2056 ns | 0.1717 ns | 0.94 | 0.04 | 1 |
XorShiftRandom_GetEvenInt | 41.89 ns | 0.8008 ns | 0.7491 ns | 2.37 | 0.10 | 9 |
XorShiftRandom_GetFloat | 18.13 ns | 0.3957 ns | 0.3702 ns | 1.03 | 0.04 | 3 |
XorShiftRandom_GetInt | 34.25 ns | 0.5721 ns | 0.5352 ns | 1.94 | 0.08 | 7 |
XorShiftRandom_GetInts | 343.56 ns | 4.4429 ns | 4.1559 ns | 19.47 | 0.74 | 15 |
XorShiftRandom_GetOddInt | 53.73 ns | 0.6136 ns | 0.5740 ns | 3.04 | 0.11 | 12 |
XorShiftRandom_GetUniqueInts | 1,419.64 ns | 26.0490 ns | 24.3662 ns | 80.43 | 3.13 | 19 |
X256SSRandom_GetDouble | 18.92 ns | 0.3072 ns | 0.2723 ns | 1.07 | 0.04 | 4 |
X256SSRandom_GetEvenInt | 40.04 ns | 0.7777 ns | 0.7275 ns | 2.27 | 0.07 | 8 |
X256SSRandom_GetFloat | 19.57 ns | 0.4259 ns | 0.4374 ns | 1.11 | 0.04 | 5 |
X256SSRandom_GetInt | 33.56 ns | 0.7014 ns | 0.6561 ns | 1.90 | 0.08 | 7 |
X256SSRandom_GetInts | 324.99 ns | 6.5127 ns | 6.9685 ns | 18.48 | 0.76 | 14 |
X256SSRandom_GetOddInt | 40.11 ns | 0.7879 ns | 0.7370 ns | 2.27 | 0.09 | 8 |
X256SSRandom_GetUniqueInts | 1,376.83 ns | 26.2667 ns | 29.1954 ns | 78.32 | 2.29 | 18 |
As mentioned on #69, I liked your idea and implementation, but I want to keep the GeneticSharp.Domain.dll without direct package dependencies.
What I can suggest to you is to move your implementation to GeneticSharp.Extensions.
Hi,
Just noticed there is a copy of FastRandom in this project. I would recommend replacing that with a ref to this project:
https://github.com/colgreen/Redzen https://www.nuget.org/packages/Redzen/
That contains a maintained version of FastRandom (now called XorShiftandom) and newer/better RNG classes, and also interfaces IRandomSource, IRandomSourceFactory.
Eventually I may refactor further and move the RNG related code into its own nuget (e.g. Redzen.Random), but for now I recommend using the code in its current home.
Regards,
Colin