Results 1 to 3 of 3

Thread: randomize a number in c#

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2003
    Location
    CANADA
    Posts
    63

    randomize a number in c#

    how to randomize a number raging 1~100 in c#?

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Random randomNumber = new Random();
    int rndNum = randomNumber.Next(1,100);

    That works pretty well, I think it goes by time to get the next random number. There are also other things you can do passing in some values to the Random constructor and things to make it even more random....

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2003
    Location
    CANADA
    Posts
    63
    thanks for help! i will try it out!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width