how to generate random numbers under OpenWRT?

Posted by user62367 on Super User See other posts from Super User or by user62367
Published on 2011-01-12T21:20:52Z Indexed on 2011/01/12 21:55 UTC
Read the original article Hit count: 279

Filed under:

With a "normal" (i mean "full") linux distro, it works just fine:

sleep $(echo "$[ ($RANDOM % 10 ) ]")

ok, it waits for about 0-9 sec

but under OpenWRT [not using bash, rather "ash"]:

$ sleep $(echo "$[ ($RANDOM % 9 ) ]") sleep: invalid number '$[' $

and why:

$ echo "$[ ($RANDOM % 9 ) ]" $[ ( % 9 ) ] $

So does anyone has a way to generate random numbers under OpenWRT, so i can put it in the "sleep"?

Thank you

© Super User or respective owner

Related posts about openwrt