Are you asking how to assign a value to the variable: n?
n = RandomValue[n+1]; // replace n's value with contents of the array at n+1

How does the program know when you have pressed "Enter"?