vendredi 13 mars 2015

Writing a C shell script that takes an input number X and generates X random numbers

I'm new to Linux/Unix (4 lectures in). An assignment tasked me to write a C shell script that takes an input in the form of a number n from the user, and generates n random numbers from a range of 1 to 10000. Then the script also reads the output list of numbers and gives the user all the prime numbers.


example:



./random_prime.csh 3


output is something like


random number: 25 3 223 the prime numbers are 3, 223



I'm not allowed to utilize "machine specific device or commands to generate random numbers or call bash's $RANDOM inside your C shell" to generate random numbers.


I'm lost...pointers anyone? TAKE PITY ON ME





Aucun commentaire:

Enregistrer un commentaire