6 Replies - 723 Views - Last Post: 14 May 2010 - 04:30 AM Rate Topic: -----

#1 Themitchel0  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 107
  • Joined: 14-April 10

Random numbers

Posted 13 May 2010 - 03:25 PM

hey i was thinking about a program i was making, and i needed random numbers in it, but i couldnt find any thing on it on google, well i did but those didnt work and they didnt help me. so any help would be nice
thanks in advance ~ themitchel0
Is This A Good Question/Topic? 0
  • +

Replies To: Random numbers

#2 MentalFloss  Icon User is offline

  • "ADDICTED"[2:5]
  • member icon

Reputation: 526
  • View blog
  • Posts: 1,397
  • Joined: 02-September 09

Re: Random numbers

Posted 13 May 2010 - 03:26 PM

http://msdn.microsof...tem.random.aspx
Was This Post Helpful? 1
  • +
  • -

#3 Themitchel0  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 107
  • Joined: 14-April 10

Re: Random numbers

Posted 13 May 2010 - 03:30 PM

thank you
Was This Post Helpful? 0
  • +
  • -

#4 Tanner.R  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 33
  • Joined: 17-April 10

Re: Random numbers

Posted 13 May 2010 - 10:09 PM

This tutorial may help you understand better. ;)
C# Tutorial: Generating Random Numbers
Was This Post Helpful? 0
  • +
  • -

#5 janne_panne  Icon User is offline

  • WinRT Dev
  • member icon

Reputation: 429
  • View blog
  • Posts: 1,047
  • Joined: 09-June 09

Re: Random numbers

Posted 13 May 2010 - 11:39 PM

View PostTanner.R, on 13 May 2010 - 09:09 PM, said:

This tutorial may help you understand better. ;)
C# Tutorial: Generating Random Numbers


Some tips to improve the tutorial:

Quote

So what that did was make a new random number named randnum then assigned a new variable named num equal to the random number.


It sounds like the Random object is a number itself while it is just an object that generates the random numbers using some algorithm each time Next method is called.

And it would be good to mention the remarks you can see on msdn. There are lots of people asking why this loop just generates 10 same numbers:
// create 10 random numbers
for (int i = 0; i < 10; i++) {
  Random r = new Random();
  Console.WriteLine(r.Next());
}


Was This Post Helpful? 1
  • +
  • -

#6 Tanner.R  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 33
  • Joined: 17-April 10

Re: Random numbers

Posted 14 May 2010 - 04:29 AM

Quote

Some tips to improve the tutorial:

Quote

Quote
So what that did was make a new random number named randnum then assigned a new variable named num equal to the random number.



It sounds like the Random object is a number itself while it is just an object that generates the random numbers using some algorithm each time Next method is called.

And it would be good to mention the remarks you can see on msdn. There are lots of people asking why this loop just generates 10 same numbers:

// create 10 random numbers
for (int i = 0; i < 10; i++) {
  Random r = new Random();
  Console.WriteLine(r.Next());
}
Thanks, Ill try to add that stuff in there. :)
Was This Post Helpful? 0
  • +
  • -

#7 Themitchel0  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 107
  • Joined: 14-April 10

Re: Random numbers

Posted 14 May 2010 - 04:30 AM

thanks you all of u for your help
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1