![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| NIM Questions | tb0ne | AIX | 5 | 08-16-2007 07:23 AM |
| A few questions... | halluc1nati0n | UNIX for Dummies Questions & Answers | 2 | 03-28-2007 10:29 AM |
| 3 questions in 1 | alikun | UNIX for Dummies Questions & Answers | 2 | 03-27-2007 02:59 AM |
| ftp questions | lewisoco | UNIX for Advanced & Expert Users | 5 | 10-27-2005 05:45 PM |
| questions | tamemi | UNIX for Dummies Questions & Answers | 1 | 08-17-2003 09:28 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
|
||||
|
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 |
|
||||
|
you can also use rand() from awk
Code:
#num=$(awk 'BEGIN{srand();print int(6*rand())+1}')
#echo $num
|
| Sponsored Links | ||
|
|