Arguably the most important difference is that Unity's Random.Range
is slightly easier to use, being static. The C# base class library System.Random
, however, offers you more control and isolation.
It's possible they also use different under-the-hood implementations (although my guess would be that Unity's Random
is just implemented in terms of the system Random
), but that's probably not a notable concern. Fundamentally they're both likely the same kind of random number generator: a pseudo-random generator based on iterating a sequence defined by some seed).
The control issue is more relevant, because in some contexts you may want to use different random streams for different things. For example, in a lock-step networking networking context, you may want to fix the seed used to generate random gameplay-affecting events across all players in the game, but you may not care so much about the stream of random numbers used for purely visual events and can allow that stream to be seeded in a more traditional fashion (with the system uptime at game launch, for example).
Similarly, if you are going to be generating random numbers in multiple threads you may want to use distinct random objects for each thread in order to prevent race conditions. This may come up if your game logic runs across many threads and you also have a gameplay replay system, for example.
In the end, it's not necessarily better to use one or the other in general, rather there are pros and cons. When you need to isolate the sequence of numbers from other potential random sequences that may be happening, or when you need localized control over the seed of the sequence, use an instance of System.Random
. If you just need a quick-and-dirty random value for a throw-away use or some other non-impactful scenario, Unity's simplified Random
is probably fine.