inherit
143665
wildgoosespeeder wildgoosespeeder wildgoosespeeder
0
Jun 14, 2018 5:59:55 GMT -8
wildgoosespeeder
ProBoards V5 be trippin'. I'm disoriented. :P
4,393
August 2009
wildgoosespeeder
|
Post by wildgoosespeeder on Jul 17, 2013 12:50:01 GMT -8
I am familiar with rand() in C++ but I am looking for an alternative similar to C# that has a bit more precision for use with floats or doubles. Does such a thing exist? //C# Random number between 0 - 99 Random random = new Random(); double randomDouble = random.NextDouble(); //Generates a 15-digit double between 0 and 1. randomDouble *= 100; int randomInt = (int)Math.Floor(randomDouble);
//C++ Random number between 0 - 99 #include <stdlib.h> #include <time.h> void main() { srand(time(NULL)); int random = rand() % 100; }
|
|
inherit
27278
0
Aug 3, 2024 9:13:18 GMT -8
Josh
Apple iManiac / eBay Addict
12,347
July 2004
jwd41190
|
Post by Josh on Aug 3, 2013 14:25:30 GMT -8
So basically you want to be able to output random number using C# that has support for doubles/floats?
For example randomly it generates something like 42.69 or 79.37
Is that what you are trying to accomplish with C#? I can probably help you but I need a little more clarity. Thanks.
|
|
inherit
143665
wildgoosespeeder wildgoosespeeder wildgoosespeeder
0
Jun 14, 2018 5:59:55 GMT -8
wildgoosespeeder
ProBoards V5 be trippin'. I'm disoriented. :P
4,393
August 2009
wildgoosespeeder
|
Post by wildgoosespeeder on Aug 13, 2013 10:11:56 GMT -8
So basically you want to be able to output random number using C# that has support for doubles/floats? For example randomly it generates something like 42.69 or 79.37 Is that what you are trying to accomplish with C#? I can probably help you but I need a little more clarity. Thanks. No, I know how to do that in C#. What I am asking is if it is possible to do that in C++ without using rand() as the older method.
|
|
inherit
58586
0
Oct 24, 2024 16:15:35 GMT -8
Omio
Quack.
2,358
September 2005
omio
|
Post by Omio on Aug 21, 2013 11:31:28 GMT -8
|
|