create website with a coinflip system php
Posted: Sun Apr 18, 2021 11:21 am
create website with a coinflip system php
https://stackoverflow.com/questions/471 ... vably-fair
As a bonus, you could add more elements to this array, and then just increase the max value in random_int(), and it will work. You could make this more dynamic as-well by doing it like this:
https://stackoverflow.com/questions/471 ... vably-fair
Code: Select all
$result = array("heads", "tails")[random_int(0,1)];
Code: Select all
$choices = ["heads", "tails", "Coin flew off the table"];
$result = $choices[random_int(0, count($choices)-1];