|
Random NUmbers Generation with out repetation
Hi
I have the below code
Code:
MAXCOUNT=10
count=1
echo
echo "$MAXCOUNT random numbers:"
echo "-----------------"
while [ "$count" -le $MAXCOUNT ] # Generate 10 ($MAXCOUNT) random integers.
do
number=$[ [$RANDOM % 20 ] + 1 ]
"echo $number"
let "count += 1" # Increment count.
done
But aftre executing this
i am getting repetative randiom numbers like ,2,5,6,6,10,8,18,14
but i want unique random numbers ?
can any one help me in solving this ?
Last edited by zaxxon; 11-25-2008 at 02:15 AM..
Reason: codetags implemented
|