10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Guys and gals...
As you know I am getting to grips with POSIX and hit this stumbling block.
Generating two random numbers 0 to 255 POSIXly. Speed in not important hence the 'sleep 1' command.
I have done a demo that works, but it sure is ugly! Is there a better way?
# Random... (12 Replies)
Discussion started by: wisecracker
2. Shell Programming and Scripting
Having a hard time with this. Very new to scripting and linux. Spent all sunday trying to do this. Appreciate some help and maybe help breaking down what the syntax does.
Create a Bash program. It should have the following properties
• Creates a secret number between 1 and 100
i. The... (3 Replies)
Discussion started by: LINUXnoob15
3. Shell Programming and Scripting
Hi there I am trying to generate a random number between 40 and 70 using the shell here is my code so far and it keeps going above 70. all help much appreciated!
comp=$(( RANDOM%70+40 ))
echo $comp (4 Replies)
Discussion started by: faintingquiche
4. Shell Programming and Scripting
I have a series of data files for which I wish to plot using "splot". Say, the files names are like:
For one file , say to plot 950_data, i write following lines into a single file and load it in the gnuplot as :
gnuplot> load 'plot'
... (6 Replies)
Discussion started by: begin_shell
5. Shell Programming and Scripting
Can anybody tell me why the second part of this script (Sieve of Eratosthenes) isn't working properly. This isnt coursework or homework just private studies ( Yes Project Euler began it ) I know there are easier ways of doing this too but I want to do it this way.:p
Iam using Cygwin on Vista... (3 Replies)
Discussion started by: drewann
Hello All, I am stuck up in a program where the rand functions ends up giving all the same integers. Tried sleep, but the numbers turned out to be same... Can anyone help me out how to fix this issue ? I have called the srand once in the program, but I feel like when I call fork the child process... (5 Replies)
Discussion started by: manisum
7. UNIX for Dummies Questions & Answers
I am trying to display contains of a file from a specific line to a specific line(let say, from line number 3 to line number 5). For this I got the shell script as shown below:
if ; then
if ; then
tail +$1 $3 | head -n $2
... (5 Replies)
Discussion started by: grc
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;
SEED=`expr $seed1 * $seed2 / $seed3`
Now, in online examples... (4 Replies)
Discussion started by: trey85stang
How can we generate 16 digit random nos in C. (10 Replies)
Discussion started by: ajaysahoo
10. Shell Programming and Scripting
Hello, need a way to generate numbers within 0.5-1.5 range
Has to be totally random:
and so on....
How to? (10 Replies)
Discussion started by: TehOne