如何改变这个生成的(000-999)值

时间:2017-02-12 10:52:40

标签: php shuffle generate-series

请修理它..

我想要改变我将从以下代码获得的值。

async def user_func1(i, c):
    print(">U1", i, c)
    await asyncio.sleep(i / 10)
    print("<U1", i, c)
    return("U1", i, c)    

async def user_func2(i, c):
    print(">U2", i, c)
    await asyncio.sleep(i / 5)
    print("<U2", i, c)
    return("U2", i, c)    

results = batch_runner([user_func1, user_func2])
for result in results:
    print(result)

请修改上述代码

帮助我

谢谢

2 个答案:

答案 0 :(得分:1)

试试这个:

$ar=range(0, 1000);
shuffle($ar);
foreach ($ar as $key => $value) {
  echo str_pad($value, 3, '0', STR_PAD_LEFT) . "<br />\r\n";
}

答案 1 :(得分:0)

$min = 0;
$max = 999;
for ( $i = 1; $i < 10; $i++){
  echo str_pad(rand($min, $max), 3, '0', STR_PAD_LEFT) . "<br>";
}