Different Random numbers for different instances of a class

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chiefy
    New Member
    • Nov 2007
    • 10

    Different Random numbers for different instances of a class

    Im writing in C# and I currently have a class called allocation that has random numbers like,
    Code:
    students[0].choiceTwo = Randnum.Next(15);
    obviously using the Random class. The random numbers are part of a method called Allocate.
    In my main method i have created 2 instances of the class
    Code:
    Allocation first = new Allocation();
    Allocation second = new Allocation();
    first.Allocate();
    second.Allocate();
    However the random numbers are the same for each instance when i need them to be different. How do i go about sorting this?
    Thankyou
  • Chiefy
    New Member
    • Nov 2007
    • 10

    #2
    Dont worry have sorted it myself, silly mistake!

    Comment

    Working...