sdrapkin / securitydriven.core Goto Github PK
View Code? Open in Web Editor NEWModern, fast, safe, cryptographically strong .NET replacement for Random and RandomNumberGenerator.
License: MIT License
Modern, fast, safe, cryptographically strong .NET replacement for Random and RandomNumberGenerator.
License: MIT License
Wanted to see if this is something that should possibly worth persuing as contrib to core .NET itself rather then standalone lib.
Hi, could you please clarify
Hi,
I find your implementation of per-thread caching clever and interesting. I think there is a pathological edge case in .NET 5 and earlier and a more likely edge case in .NET 6 that will cause a problem, however.
.NET 6 changes Environment.ProcessorCount
to return a number less than the number of processors in two cases:
- If the process is running with CPU affinity, the number of processors that the process is affinitized to.
- If the process is running with a CPU utilization limit, the CPU utilization limit rounded up to the next whole number.
In this case I believe Thread.GetCurrentProcessorId
can return a number greater than Environment.ProcessorCount
(especially in the case that the process affinity is set to, say, the seventh and eight CPU cores).
In all versions of .NET "The value returned by this API is fixed at .NET runtime startup for the process lifetime" and in certain virtualisation environments support hot add vCPU so more processors could be added after the application starts.
In any case, if either of the above situations transpires then this line will throw an IndexOutOfRangeException
.
Please note I do not have .NET 6 or virtualization software with hot add vCPU on hand, so I apologise if this is a hypothetical. The breaking change documentation for .NET 6 is here and it suggests this might already be a problem when running on Unix-based hosts.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.