【发布时间】:2010-10-26 04:34:05
【问题描述】:
我想要一个小的 php 函数来选择一个介于 0 到 5 之间的数字,有 50% 的几率为零,并且还可以同时在两个字符串之间随机选择:
算法:
choose number between 0,1,2,3,4,5 randomly
(50% chance for zero, 50% chance for 1,2,3,4,5)
and
choose string blue, yellow randomly
return(number, string);
php 可以在一个函数中做到这一点。干杯:)) 谢谢
【问题讨论】:
标签: php string function random