title: How to generate random integers in R so that no two consecutive numbers are the same
body: <p>Is there a method to generate random integers in R such that any two consecutive numbers are different? It is probably along the lines of <code>x[k+1] != x[k]</code> but I can't work out how to put it all together.</p>