Generate random float numbers in range PHP

前端 未结 5 1791
夕颜
夕颜 2020-12-18 09:38

I have a code that initializes a dice object by the following code:

public function initializeDiceSides($totalSides, $fair, $maxProbability = 100) {
   $maxT         


        
5条回答
  •  臣服心动
    2020-12-18 10:00

    You could multiply the variables that you feed into mt_random by a factor of, say, 100000, and then divide the output by the same factor to get a float value.

提交回复
热议问题