Can someone provide me with a string that generates randomized numbers that have a range from #-#. So if i wanted the DOS window to generate a number from 5-10; how would i do it? Thx
-Cloud
Can someone provide me with a string that generates randomized numbers that have a range from #-#. So if i wanted the DOS window to generate a number from 5-10; how would i do it? Thx
-Cloud
What does that mean? How does a string generate random numbers?Can someone provide me with a string that generates randomized numbers
i mean i want a code to generate me random numbers from range to range
That is in the link treenef posted.
have a look at the boost random library.
"I saw a sign that said 'Drink Canada Dry', so I started"
-- Brendan Behan
Free Compiler: Visual C++ 2005 Express
If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?
How do i set the max?Code:/* * This code is written in C, but it could just as easily be done in C++. * The rand() and srand() functions are available in both languages. */ #include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { int i; srand(time(NULL)); i = rand(); printf ("Your random number is %d\n", i); printf ("This compiler can generate random numbers from 0 to %d\n", RAND_MAX); return(0); }
Look down further.
Not only does it have that code for C++ but below that it also had the range code.
Also see Prelude's "Brain Vomit": http://www.eternallyconfuzzled.com/articles/rand.html
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.