![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| NIM Questions | tb0ne | AIX | 5 | 08-16-2007 04:23 AM |
| A few questions... | halluc1nati0n | UNIX for Dummies Questions & Answers | 2 | 03-28-2007 07:29 AM |
| 3 questions in 1 | alikun | UNIX for Dummies Questions & Answers | 2 | 03-26-2007 11:59 PM |
| ftp questions | lewisoco | UNIX for Advanced & Expert Users | 5 | 10-27-2005 02:45 PM |
| questions | tamemi | UNIX for Dummies Questions & Answers | 1 | 08-17-2003 06:28 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Few questions
RANDOM is from 1 - 32767 how can i set it to be from 1 - 6
how can i give every user 100 points at start lets say a game. within the script if i create users will it by default prevent creating users with same name twice. I am a beginner in this field and want to do a little game and appreciate any help Thanks in advance Gina |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Take mod of the value which you desire.
for values from 1..x and if you want reduce the set to 1..y take mod value for x and y. Taking mod value with y for value x, will bring down the set 1..x to 1..y |
|
#3
|
|||
|
|||
|
you can also use rand() from awk
Code:
#num=$(awk 'BEGIN{srand();print int(6*rand())+1}')
#echo $num
|
|||
| Google The UNIX and Linux Forums |