[`Add`] `RandomNumberFactory` Class
Description
Removed RandomExtensions.NextBigIneger method.
Replaced RandomExtensions.NextBigIneger with RandomNumberFactory methods.
Added RandomNumberFactory class to the Neo.Extensions library.
Type of change
- [x] Optimization (the change is only an optimization)
- [ ] Style (the change is only a code style for better maintenance or standard purpose)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
How Has This Been Tested?
- [x] Unit Testing
Checklist:
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
- [x] Any dependent changes have been merged and published in downstream modules
Rand is an extension of Random so Random has Random.NextBigInteger().
checked, Randomnumbergenerator provides Cryptographically secure randdomness.
Randis an extension ofRandomsoRandomhasRandom.NextBigInteger().
this extension should be removed, we don't need the Random instance with this
The RandomNumberGenerator is much slower than current implementation;
This extension method used in ECFieldElement.Sqrt, and I found another implementation:
https://github.com/bcgit/bc-java/blob/main/core/src/main/java/org/bouncycastle/math/ec/ECFieldElement.java#L292.
This java implementation also uses pseudo-random numbers.
Pseudo-random numbers seem to be good enough here.
Ok changes have been made.
The
RandomNumberGeneratoris much slower than current implementation;This extension method used in
ECFieldElement.Sqrt, and I found another implementation: https://github.com/bcgit/bc-java/blob/main/core/src/main/java/org/bouncycastle/math/ec/ECFieldElement.java#L292. This java implementation also uses pseudo-random numbers.Pseudo-random numbers seem to be good enough here.
Remind.
The
RandomNumberGeneratoris much slower than current implementation; This extension method used inECFieldElement.Sqrt, and I found another implementation: https://github.com/bcgit/bc-java/blob/main/core/src/main/java/org/bouncycastle/math/ec/ECFieldElement.java#L292. This java implementation also uses pseudo-random numbers. Pseudo-random numbers seem to be good enough here.Remind.
This will also be used in neo-build. So, it needs to be crypto random generator.