We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I would like to control the output of the below random function. I want that it return a number between the min and the max parameters. but it didn't. can you tell what should I change to do that. in the web, I found that 10000 should be the maximun that can be generated
I use a f340 with the tcp-ip conf wiz.
int random(int min, int max){ int res = min + (int)(my_rand()/10000*(max-1)); return res; }
"the below random function"
Be sure to understand that it is a pseudo-random function!
"but it didn't."
So what did it do? What thought have you given to why that might be, and how it could be changed to your requirement?
You haven't shown your definition of 'my_rand' - so how can anyone tell what it might be doing?!
Please also read the instructions on how to post source code: www.danlhenry.com/.../keil_code.png and be sure to pay attention to the preview!