1. We've introduced thread tags, search within a thread and similar thread search. Read more here.
    Dismiss Notice
  2. We've released our first Timeline Experimental Preview, our new tool for creating cutscenes and more! To check it out click here.
    Dismiss Notice
  3. All Unity Pro perpetual license customers: your special offer to subscribe is ready! Click here.
    Dismiss Notice
  4. Unity 5.5 is now released.
    Dismiss Notice
  5. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  6. Unity 5.6 beta is now available for download.
    Dismiss Notice
  7. Get prepared for the Tizen Mobile App Incentive Program! Read more about the upcoming program here.
    Dismiss Notice
  8. Enter the Microsoft Developer Challenge for a chance to win prizes. Read more about it here.
    Dismiss Notice

Random.seed

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

  1. christopherbrown

    christopherbrown

    Joined:
    Oct 19, 2009
    Messages:
    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
    Messages:
    30,865
    Not necessary in Unity...only use Random.seed if you want repeatable sequences.

    --Eric
     
  3. christopherbrown

    christopherbrown

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

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Messages:
    30,865
    Yes, or Random.Range.

    --Eric