1
$ awk 'BEGIN{srand('"$RANDOM"');print int(rand() * [最大値])}'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$ cat rand.sh
for i in `seq 1 30`; do
NUM=`awk 'BEGIN{srand('"$RANDOM"');print int(rand() * 50)}'`

echo $NUM
done

$ ./rand.sh
29
41
7
42
16
44
10
34
34
29
22
46
9
9
4
1
11
40
43
46
44
49
4
41
15
38
18
47
21
1