Skip to main content
added 3 characters in body
Source Link
H. Pauwelyn
  • 805
  • 5
  • 17
  • 31

What's the different between this

int randomNumber = UnityEngine.Random.Range(0, 10);

and this

// on top of the class
private System.Random _rnd = new System.Random();

// inside a methode of the same class
int randomNumber = _rnd.Next(0, 10);

I know System.Random must always be initialized on the top of your class what's by UnityEngine.Random is not needed. I know also that System.Random works with a intern clock"clock" and the "random" number is based on that.

My question is now are there some other difference between UnityEngine.Random and System.Random and witch code is better to use for aan Unity project?

What's the different between this

int randomNumber = UnityEngine.Random.Range(0, 10);

and this

// on top of the class
private System.Random _rnd = new System.Random();

// inside a methode of the same class
int randomNumber = _rnd.Next(0, 10);

I know System.Random must always be initialized on the top of your class what's by UnityEngine.Random is not needed. I know also that System.Random works with a intern clock and the "random" number is based on that.

My question is now are there some other difference between UnityEngine.Random and System.Random and witch code is better to use for a Unity project?

What's the different between this

int randomNumber = UnityEngine.Random.Range(0, 10);

and this

// on top of the class
private System.Random _rnd = new System.Random();

// inside a methode of the same class
int randomNumber = _rnd.Next(0, 10);

I know System.Random must always be initialized on the top of your class what's by UnityEngine.Random is not needed. I know also that System.Random works with a intern "clock" and the "random" number is based on that.

My question is now are there some other difference between UnityEngine.Random and System.Random and witch code is better to use for an Unity project?

added 55 characters in body
Source Link
H. Pauwelyn
  • 805
  • 5
  • 17
  • 31

What isWhat's the different between this

int randomNumber = UnityEngine.Random.Range(0, 10);

and this

// on top of the class
private System.Random _rnd = new System.Random();

// otherinside codea methode of the same class
int randomNumber = _rnd.Next(0, 10);

I know System.Random must always be initialized on the top of your class what's by UnityEngine.Random is not needed. I know also that System.Random works with a intern clock and the "random" number is based on that.

My question is now are there some other difference between UnityEngine.Random and System.Random? Wich and witch code is better to use for a Unity project?

What is the different between this

int randomNumber = UnityEngine.Random.Range(0, 10);

and this

private System.Random _rnd = new System.Random();

// other code
int randomNumber = _rnd.Next(0, 10);

I know System.Random must always be initialized on the top of your class what's by UnityEngine.Random is not needed. I know also that System.Random works with a intern clock and the "random" number is based on that.

My question is now are there some other difference between UnityEngine.Random and System.Random? Wich code is better to use for a Unity project?

What's the different between this

int randomNumber = UnityEngine.Random.Range(0, 10);

and this

// on top of the class
private System.Random _rnd = new System.Random();

// inside a methode of the same class
int randomNumber = _rnd.Next(0, 10);

I know System.Random must always be initialized on the top of your class what's by UnityEngine.Random is not needed. I know also that System.Random works with a intern clock and the "random" number is based on that.

My question is now are there some other difference between UnityEngine.Random and System.Random and witch code is better to use for a Unity project?

Tweeted twitter.com/StackGameDev/status/684094200045015040
edited tags; edited title
Link
user1430
user1430

Different What's the difference between UnityEngine.Random and System.Random?

Source Link
H. Pauwelyn
  • 805
  • 5
  • 17
  • 31
Loading