EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Random item number generator (https://www.eqemulator.org/forums/showthread.php?t=42908)

theoneptd 05-02-2020 05:55 PM

Random item number generator
 
Using the global_npc.pl file with the subroutine EVENT_SPAWN and attempting to generate a random loot id number. Has anyone run into an issue where srand() is implicitly called to seed rand() and is causing a limited of possible numbers?

I am seeing issues of numbers being generated multiple times while others are never. rand(100000) for instance.

I just do not feel 94823 should be generated 20 times, while 94823 never is generated. It looks like only a fraction of the numbers are being chosen , while a large amount are being repeated.

my $addid = ( int rand 100000 ) + 1001;

Thanks for your time.


All times are GMT -4. The time now is 01:07 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.