Reputation: 683
What is the c# System.Random
algorithm implementation and is it a good pseudo-random from cryptography perspective?
Upvotes: 1
Views: 737
Reputation: 10882
The source to Random
can be see here: http://referencesource.microsoft.com/#mscorlib/system/random.cs
The Random
class is not cryptographically secure. For security purposes, use the System.Security.Cryptography.RNGCryptoServiceProvider
class.
Edit 18/04/2021: For .NET Core, you should use the RandomNumberGenerator
class for a cross-platform random number generator suitable for security-related scenarios.
Upvotes: 4