Page 4 of 4

Re: Generic game programming / C# thread

Posted: Fri Nov 04, 2011 12:03 am
by Korban3
I'll be sure to try to not forget :P
You can always check my twitter as well. I don't update much more than once a day, and sometimes not even that. But I usually put info on there when it happens.
http://twitter.com/#!/ButtsGames

Re: Generic game programming / C# thread

Posted: Sun Nov 06, 2011 10:38 am
by Endoperez
blood-shard wrote:Nice to hear about your progress :D

Please get back to us as soon as possible, on how that's gonna turn out :)

The functions for generating random numbers are usually under Math. C# didn't do it this way. I think you had to create an object from the Random class, and then use that object to call the functions that return random values. Something like this:

Random rand_numbers = new Random();

int diceroll = rand_numbers.Next(1,6);

edit: this is a better example
edit2: it seems that in Random.Next(int minvalue, int maxvalue) argument minvalue is inclusive, but maxvalue is exclusive. So the original example above generates numbers 1, 2, 3, 4 or 5 but NOT 6. For a normall dice roll, you'd need:

int diceroll = rand_numbers.Next(1,7);

Re: Generic game programming / C# thread

Posted: Sun Nov 06, 2011 10:41 am
by blood-shard
Endoperez wrote:
blood-shard wrote:Nice to hear about your progress :D

Please get back to us as soon as possible, on how that's gonna turn out :)

The functions for generating random numbers are usually under Math. C# didn't do it this way. I think you had to create an object from the Random class, and then use that object to call the functions that return random values. Something like this:

Random rand_numbers = new Random();

int diceroll = rand_numbers.Next(1,6);

edit: this is a better example
Thanks for some input on that. I'll look into it.