dimanche 20 septembre 2020

How do I generate random numbers from a seeded generator in C# that will continue to produce the same numbers over time?

Reading the documentation for C#'s built-in Random class, it describes how the same seed can't be relied upon to produce the same set of numbers from version to version: https://docs.microsoft.com/en-us/dotnet/api/system.random?view=netcore-3.1#notes-to-callers

I want to be able to generate random numbers using a seed and have that seed always continue to work regardless of .NET version or device. Not being able to upgrade from one version of .NET to another because of seed incompatibility would not be an option. What is the standard practice to do protect against this? My current best idea is to have an RNG algorithm built into the project, but I feel like there must be better options?




Aucun commentaire:

Enregistrer un commentaire