![]() |
Random_long(0, ??)
I actually wonder what RANDOM_LONG takes for args.
Is it: RANDOM_LONG(from, TILL) or RANDOM_LONG(from, including) meaning: RANDOM_LONG(0,10) can return 0,1,2,3,4,5,6,7,8,9 or it can return: 0,1,2,3,4,5,6,7,8,9,10 i need to know this because my current function does not seem to return all goals i want, or... it could be i have been darn unfortunate: Code:
// Find a goal, and return the node close to it |
Re: Random_long(0, ??)
I think (and especially hope, I use it VERY much) it will include the lowest and highest number. But you can easily find it out just print every frame a random number between 0 and 10 to an file and play about 5 minutes :)
|
Re: Random_long(0, ??)
yes, i know, i am just to lazy (grtz at pierre ;) ) to put such code in my bot...
|
Re: Random_long(0, ??)
RANDOM_LONG(0,10);
Code:
Random Long from 0 to 10 : 4 |
Re: Random_long(0, ??)
yay :) all numbers are in the list
|
Re: Random_long(0, ??)
else write your own random number generating facility, and don't bother calling functions in the engine for that. I'm considering this with more and more interest, actually :)
|
Re: Random_long(0, ??)
I wanted to ask If RANDOM_LONG (or RANDOM_FLOAT) is better
then using rand() function (eg. is it faster or is it only to ease programming ?) |
Re: Random_long(0, ??)
I agree with what PMB is saying, use as little of the engine as you can. You should try and separate your code from the engine through a clean interface.
I don't know which functions will be better, but my guess is that rand() will be faster to call. The best reason to use your own random_long (etc) is that you can reuse the code for other projects. For example, I built all my own timing functions and I don't use the engine for timing at all. Now I can use these same functions on other projects which is nice. My code is much cleaner too, and problems that some people had with the engine timing never affected me. |
Re: Random_long(0, ??)
Quote:
|
Re: Random_long(0, ??)
Quote:
I once saw some people had problems over at the botmans forums, but now I can't remember exactly what it was. |
All times are GMT +2. The time now is 15:28. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.