abdolahS
abdolahS

Reputation: 683

C# random function algorithm implementation and its randomness

What is the c# System.Random algorithm implementation and is it a good pseudo-random from cryptography perspective?

Upvotes: 1

Views: 737

Answers (1)

Martin Costello
Martin Costello

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

Related Questions