|
发表于 2003-10-10 11:41:29
|
显示全部楼层
最初由 idkey 发表
[PHP]#!/bin/sh
# Last modified: 2003年10月10日 星期五 10时49分55秒 [test]
alphabeta="a b c d e f g h i j k l m n o p q r s t u v w x y z"
number="0 1 2 3 4 5 6 7 8 9"
A=($alphabeta) # save as array
N=($number)
num_a=${#A} # number of ...
num_n=${#N}
# choice now
echo ${A[$((RANDOM%num_a))]}${N[$((RANDOM%num_n))]}[/PHP]
用((...))运算符确实要比用bc效率高些 ,, :thank idkey |
|