I am making a plugin that gives a player a random amount of money, and I want to send the player a message of how much money they won.
if you want true randomness, it is better to hitch a ride on webAPI nothing can like mt rand can achive true randomness like a actual true random generator maybe using crypto currency for no rate limit but if you are just a normal developer who dont even know what true randomness is, just use mt_rand for if they won OR how much they would get
I did that originally but it wasn't how I wanted it. The code that I'm using now is. PHP: $money =rand(100000, 400000);EconomyAPI::getInstance()->addMoney($p, $money);$p->sendMessage("You won ".$money);
No because it will send a message with a number 100000 - 400000 intead of getting the money that they won.
Well you gave the player the money of $money, which is the same number you sendMessage to your player, so whats the problem?
It doesn't work like that. If the player won $125,630 it will send a message but it will just randomize again and send a different number like 365,443
Wtf? When you call a function and assign it to a variable it stores the value that the function returns, not the function.
PHP: public function addMoney(){$prize = mt_rand(1,3);switch($prize){case 1:EconomyAPI::getInstance()->addMoney($player, "50");break;case 2:EconomyAPI::getInstance()->addMoney($player, "150");break;case 3:EconomyAPI::getInstance()->addMoney($player, "200");break;
can you try to do PHP: EconomyAPI::getInstance()->addMoney($player, 300000); and see if you really received 300,000
crypto is not true randomness either. I still think that connecting a beta radiation source next to a GM counter with data logger is the best randomness generator.