Search code examples
phpphp-generators

php generating random numbers multiple of 10 with min and max


I want to generate random numbers multiple of 10 with minimum and maximum conditions. Example 10, 40, 20, 100, 60. numbers between 10 and 100


Solution

  • Following segment will give your desire random number

    mt_rand(ceil($min/10) , floor($max/10))*10;
    

    Please try something on your own before asking someone else to help you.