Sponsored Content
Full Discussion: Random pieces of number
Top Forums Shell Programming and Scripting Random pieces of number Post 302443900 by Tytalus on Tuesday 10th of August 2010 11:15:03 AM
Old 08-10-2010
One somewhat hacky way:

Code:
x=30;n=234951; while [ $x -gt 0 ]; do y=$(expr \( $RANDOM \* $RANDOM \) % \( $n - $x - 1 \) + 1 ); n=$(($n-$y)); echo $y; x=$(($x-1)); done;echo $n


not clean at all, but you may take some inspiration from it :-)
 

10 More Discussions You Might Find Interesting

1. Programming

How to generate a random number?

How to generate a random integer with specific range(for example, from 1 to 1000)? Also, how to convert a floating point number into a integer? (2 Replies)
Discussion started by: MacMonster
2 Replies

2. Programming

Random number generation

Hi...How can I generate random numbers between a given range ...preferably between 1 and 100...in UNIX C programming...? I tried out functions like rand(),drand48() etc but didnt get satisfactory results... Thanks a lot in advance.......... (1 Reply)
Discussion started by: tej.buch
1 Replies

3. Shell Programming and Scripting

Regarding Random Number Genration

HI please help me in solving this issue. I have a shell script which consists of ten statemnts ( i mean 10 executable statments)...........and if i run that script the 10 statmenst will execute continously ............ But now my probelm is i have to write another script --> to... (0 Replies)
Discussion started by: lalitka
0 Replies

4. Linux

random number as file owner

Dear all, I get the situation from my office but i cannot think what is happening. please give me some advise. 1. some file owner and group is changed to a very long number 2. i login as root. when i touch a file or operate on the file like chown, cp, the response is "Read-only file system".... (1 Reply)
Discussion started by: rickhlwong
1 Replies

5. Shell Programming and Scripting

ksh: random number between 1-10

How do I create a random number between 1 and 10 in kornshell? (2 Replies)
Discussion started by: dangral
2 Replies

6. Programming

C Help; generating a random number.

Im new to C, and Im having a hard time getting a random number. In bash, I would do something similar to the following to get a random number; #!/bin/bash seed1=$RANDOM seed2=$RANDOM seed3=$RANDOM SEED=`expr $seed1 * $seed2 / $seed3` echo ${SEED%.*} Now, in online examples... (4 Replies)
Discussion started by: trey85stang
4 Replies

7. Programming

Random number is not reused

I need to generate and reuse a 5 digit random number every time my program is executed. But the following generates random numbers every time the function is called. #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include <time.h> ... (12 Replies)
Discussion started by: limmer
12 Replies

8. Programming

Generate random number

I saw this formula to generate random number between two specified values in shell script.the following. $(((RANDOM%(max-min+divisibleBy))/divisibleBy*divisibleBy+min)) Give a example in book. Generate random number between 6 and 30.like this. $(((RANDOM%30/3+1)*3)) But I have a... (1 Reply)
Discussion started by: luoluo
1 Replies

9. Shell Programming and Scripting

Create random number

Hi, I'm trying to create a script that will print random numbers with length of three. Below is the expected out. 928-377-899 942-458-310 951-948-511 962-681-415 995-161-708 997-997-209 thanks (4 Replies)
Discussion started by: reignangel2003
4 Replies

10. Programming

random number

How can I choose randomly the row numbers of my file in awk? (4 Replies)
Discussion started by: Homa
4 Replies
JESTER(6)							   Games Manual 							 JESTER(6)

NAME
jester - an X-based game similar to Othello(tm) SYNOPSIS
jester [{-display, -d, --display} display] [{-h, -help, --help}] [-2players] [-ai {white, black}] DESCRIPTION
jester is an X-based game similar to the board game Othello. jester allows you to waste hours of otherwise productive time that could be spent playing Solitaire instead. GAME PLAY
There are two players, one playing the white pieces, the other playing the black pieces. Each player takes turns placing a piece of his or her color on an 8x8 board. Each piece must be placed so as to bracket a line of the opponent's pieces between two of the current player's pieces. When this happens, the opponent's pieces are replaced by pieces of the current player's color. When the cursor is over a square that it is legal for the current player to play in, the cursor will change to a pointing hand. A small rectangle in the upper right side of the window shows the color of the current player. The game ends when a player cannot make a move, either because the board is full or because the position of the pieces makes it impossible to make a move. At this point, the player with the most pieces on the board is the winner. You will be offered the option of starting a new game. You may exit at any time by clicking the "Exit" button. OPTIONS -d, -display, --display display Display on display. -h, -help, --help Print a help message and exit. -2players Play against another person at the same console. -ai {white, black} Tell the computer which side to play. The default behavior is equivalent to -ai black. ENVIRONMENT
jester uses the environment variable "DISPLAY" as the default display. This can be overridden on the command line. BUGS
None known... AUTHOR
Matt Grossman <mattg@oz.net> 5/16/1998 jester 1.0 JESTER(6)
All times are GMT -4. The time now is 02:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy