In Nightbot commands, inner variables always evaluate before outer variables, and variables only ever evaluate once. This means that you cannot use a “for” loop to repeatedly call a custom API. Whatever result you get from randomnumber.php will be used over and over in your $(eval) code.
The randomnumber API was written before the $(eval) variable was introduced. Generating random numbers can now be done quite easily with Math.random() in JS. The following code performs the same task but within one $(eval) and includes input checking (making sure the inputs are positive integers).
thanks for the reply. I was planning on using this for RPG dice roll. Do you think math.random() is enough randomness for this? considering it cannot be seedable.
Users may have different standards for what looks random. I suggest trying the command a few times and seeing if it gives a distribution of numbers that you can comfortably say is random enough.