I created a new web API project using ASP.NET 5 patterns. I want to generate random numbers using System.Security.Cryptography.RandomNumberGenerator, but it is not available in the .NET Platform 5.4 platform (see screenshot).

Compilation also leads to the following errors:
Error CS0234 The type or namespace name 'Cryptography' does not exist in the namespace 'System.Security' (are you missing an assembly reference?) Error CS0246 The type or namespace name 'RandomNumberGenerator' could not be found (are you missing a using directive or an assembly reference?) Error CS0103 The name 'RandomNumberGenerator' does not exist in the current context
Is there a way to use this, or is there an alternative random generator that I can use that is cryptographically secure?
source share