So, we have 6 numbers (123456). It is necessary that the numbers 1 and 2 have a 70% chance of falling out, and 3456 have a chance of 30%.
Tell me, please, how to implement php?
So, we have 6 numbers (123456). It is necessary that the numbers 1 and 2 have a 70% chance of falling out, and 3456 have a chance of 30%.
Tell me, please, how to implement php?
$n = rand(1,1000); if ($n <= 350) { echo 1; } elseif ($n <= 700) { echo 2; } elseif ($n <= 775) { echo 3; } elseif ($n <= 850) { echo 4; } elseif ($n <= 925) { echo 5; } else { echo 6; } Here it is possible
$v = rand(1,100) <= 70 ? rand (1, 2) : rand(3, 6); Source: https://ru.stackoverflow.com/questions/527762/
All Articles