random

• 07-12-2002
Klinerr1
random
is the a code to say to randomly goto a line between 2 lines like 100 and 200 expect for 104 and 304 and a bunch of other specefic lines. is this possible
• 07-12-2002
Uraldor
look in the tutorial section of this site for random numbers, look on the web for random numbers, SEARCH THIS BOARD FOR RANDOM NUMBERS!!!

This question has been asked a million and one times.

if that's not enough information, go to google and search for "problem solving tutorials"

U.
• 07-12-2002
golfinguy4
Get a random number. From there, use the random number in a switch statement, and call different functions in each case.
• 07-12-2002
Klinerr1
what? how about this you might understnad it bette,r i need a code to say to give a number to a varible like it randomly chooses a number between 100 and 200 besides smoe certina numbers. then go to the line with that number life if it chose 132 it goes to linme 132. can someone make a sameple cpp file for doign this or asomething similar.
• 07-13-2002
tudehopet
Here is a snippet of the code

int ln;
srand(time(0));
ln = rand()%100+200;
goto ln;

I think thats right.

Just try it, you never know.
• 07-13-2002
*ClownPimp*
> then go to the line with that number life

please people, proofread your posts to make sure they make sense!

do you mean execute some line of code? jump to a certain line in a file? we are not mind readers
• 07-14-2002
Klinerr1
i need a code to picka random number inbatween two numbers than give it to a varible. thats the best way i cant explain it
• 07-14-2002
The Dog
This might satisfy your needs.;)

Code:

```#include <stdlib.h> #include <iostream.h> #include <time.h> int function(int*,int,int); int main() {     int variable=0;     srand( (unsigned)time( NULL ) );     variable = function(&variable,100,200);     cout << variable;     return 0; } int function(int* variable, int lower, int upper) {     return (*variable = upper - (rand()%(upper-lower)+1) ); }```
• 07-14-2002
Unregistered
variable = function(&variable,100,200);

sorry 'bout that, should've been

function(&variable,100,200);