-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved RandomHelper #20531
base: dev
Are you sure you want to change the base?
Improved RandomHelper #20531
Conversation
@maliming I'm OK with rewriting this in such a way to avoid the dependency, basically copying and pasting the code in and adding a comment at the top for credit, and we can leave them public as well. Would that work for you? |
That would be great. 👍 |
I tried to do this but unfortunately this should be multi-targeting a framework version that is not being targeted in Volo.Abp.Core, namely .NET 6.0 where It would be best to have these micro optimizations handled externally in a dedicated and controlled assembly. Therefore my recommendation is to optimally take the micro-dependencies. |
These changes will be easier to maintain and understand. What do you think? https://github.com/abpframework/abp/pull/21089/files Also applies to #20530 |
There are some changes that should be done here.
If you want I can modify this PR and import the two libraries here in separate files. They won't be fully optimized due to the lack of extra targeting, but it will work. As for #20530, please discuss there. The changes absolutely need to be in a different assembly there. |
Thanks. I will check it later. |
Internally uses Random.Shared when available (.NET 6.0), otherwise uses a thread-safe random.
Furthermore, list shuffling uses the Fisher-Yates algorithm for better performance.