need to use random but dont know about this

 

I can not use a function or mathsrand mathrand,
I want the variable "int aléa" gives me a number between 1 and 10

and if i want to change the "32767" by "2"

MathSrand(TimeLocal()); // Display 10 numbers.

for(int aléa=0;aléa<10;aléa++ ) Print("random value ", MathRand());

BUT The MathRand function returns a pseudorandom integer within the range of 0 to 32767

I WANT TO CHOOSE RETURNS ?FOR EXEMPLE : 0 TO 1, or 1 to 10, or 1 to 100


thanks for all who want to help me, bye.
 
int  Random(int min, int max){  return( MathRand()/32768.0*(max-min+1)+min );  }
 
WHRoeder:

i tried to use that but i don't know...what should I do?

 when i compile the code, it give me error : Function "Random" is not referenced and will be removed from exp-file    

thanks...
 
harold:
i tried to use that but i don't know...what should I do?

 when i compile the code, it give me error : Function "Random" is not referenced and will be removed from exp-file    

If you don't CALL  the function it is not used and will not be compiled . . . .  call the function.  You need to take the time to read what has been offered to you for free . . .  understand it then use it.  If you can't or won't do that then use the Jobs facility instead:  Jobs
 
RaptorUK:
If you don't CALL  the function it is not used and will not be compiled . . . .  call the function.  You need to take the time to read what has been offered to you for free . . .  understand it then use it.  If you can't or won't do that then use the Jobs facility instead:  Jobs


as I could not, I do like this and it looks okay to me

int min=1,max=10,Random;  // at the top


Random=(MathRand()/32768.0*(max-min+1)+min ); // at init  start

Comment("Random = ",Random);


In any case, thank you, really! bye