softwerkab / fortnox-csharp-api-sdk

.NET SDK for Fortnox API.
MIT License
53 stars 65 forks source link

Rewrite the GenerateState method #254

Closed vanillajonathan closed 2 years ago

vanillajonathan commented 2 years ago

Using the static members of the RandomNumberGenerator class is the preferred way to generate random values.

To create a random number generator, call the Create() method. This is preferred over calling the constructor of the derived class RNGCryptoServiceProvider, which is not available on all platforms.

https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.randomnumbergenerator

richardrandak commented 2 years ago

Thanks for the improvement. Just a note, the random number generator is IDisposable. The previous solution was handling it by the "using" keyword. The new version does not. Could you fix that or was that intentional?

richardrandak commented 2 years ago

Feature added in the commit