1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Are you an artist or level designer going to Unite Europe? Join our roundtables there to discuss artist features.
    Dismiss Notice
  6. Unity 5.6 is now released.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

Random.seed

Discussion in 'Scripting' started by christopherbrown, Dec 11, 2009.

  1. christopherbrown

    christopherbrown

    Joined:
    Oct 19, 2009
    Posts:
    83
    Does anybody know how Unity handles the seeding of their random number generator? In C/C++ I'm used to having to specify the seed, usually based upon the current time. Does Random.seed perform this task for you since you don't actually have to assign a value to it?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    31,135
    Not necessary in Unity...only use Random.seed if you want repeatable sequences.

    --Eric
     
  3. christopherbrown

    christopherbrown

    Joined:
    Oct 19, 2009
    Posts:
    83
    Interesting. So is Random.value is sufficient in generating your pseudo-random numbers?
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    31,135
    Yes, or Random.Range.

    --Eric