What is the difference between System.Random and UnityEngine.Random?

What is the difference between System.Random and UnityEngine.Random?
What should be preferred?System.Random or UnityEngine.Random?

Note that UnityEngine.Random is a static class that provides only a single, “global” stream of random values per game. If you want genuinely random values, it’s fine.

However, each instance of System.Random you create is an independent random number generator stream. Each generator is only advanced when its nextValue() is called, which means it’s much easier to create reproducible sequences of random numbers starting from a given seed.

Suppose you had two completely separate events in your game that both had a degree of random behaviour - the frequency of loot drops in a chest, and a variance in the speed with which bullets fired from a gun. If you use UnityEngine.Random, you’re making those two random distributions entwined - the number of times you’ve fired your gun will influence the value that determines whether you get ultra-rare armour from a chest. This, in turn, makes testing your game very hard. So, for anything other than completely trivial random behaviour, I recommend using System.Random (and also initialising with a known seed)

This is an old post, but if you have any doubt, I found a full a very detailed article that explains when to use one or another: https://gamedevelopertips.com/unityengine-random-vs-system-random/

Unity’s Random is a utility for random values. It has additional features, such as returning a random rotation. See the documentation here:

System.Random is for generating random values in a range.

It doesn’t matter which one you use. For just getting a random number, I prefer System.Random since it is easy to use and part of the core system library.