#AWK
AWK
BEGIN { srand(n=split("John Jeff Emma Steve Julie.",A)) print A[int(rand()*n+1)] } Sorry, Steve!!! :-P
Feeding
srand()with a constant shall reproduce the same sequence ofrand()values over and over again. On my systemgawkandmawkselected Steve but this may not be globally immutable...
But now for something completely different with really seeding srand():
BEGIN { srand() split("John Jeff Emma Steve Julie.",A) print A[int(rand()+1)] } Sorry, John!
srand()really seeds therand()as expected andrand()+1looks like correctly taking care of the names are stored inA[1]and following indices but becauserand()always is smaller than1,int(rand()+1)always will be1.