int ( rand (5 - $rei / 5) )

$reiに0が入る時の結果は0〜4
1〜5が入る時には0〜3
6〜10が入る時には0〜2
であっているでしょうか?