Raised This Month: $ Target: $400
 0% 

random_num .. not that random


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-27-2014 , 19:23   Re: random_num .. not that random
Reply With Quote #1

Quote:
Originally Posted by Cv3 View Post
PHP Code:
random_num(0,TOTALROWS 1
If you are using it to select a random index for an array, you should use random(sizeof(my_array)).


Quote:
Originally Posted by Cv3 View Post
the problem occurs, I have 5 servers selecting from the same file. And they are not supposed to "random" select the same thing.
What you describe here is NOT purely random.

Quote:
Originally Posted by Cv3 View Post
At all this random_num thing is not that random .. how can I randomize it completely ?
You just said that you didn't want a random selection because you don't want your other servers to get the same number. This is how random works. There is a chance that you will get the same number every single time that the function is used.

random() and random_num() is the most random you can get with AMX Mod X. Other computer-based random functions won't be much, if any, better than these. If you want truly random, start flipping coins (but you don't want random because you stated that in your post).

In conclusion, if you want help, you will need to describe better your situation and what you really want (not what you think you need to get what you want; aka "The XY Problem").

EDIT: This might be helpful: [HOW TO] Retrieve random values from an array without retreiving the same twice
__________________

Last edited by fysiks; 12-27-2014 at 19:32.
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode