Find the shortest way to generate a random number between 0-9 without repeating the last generated number. Here is an example written in javascript.
var n=t=0;
while(n==t){
t=Math.floor(Math.random()*9);
}
n=t;
I don't know if it is possible, but it would be interesting if there is a solution using only one variable.
To clarify the solution can be in any language. Based on the comments I am going to disallow using arrays since apparently that makes it very easy and this is code-golf so the shortest answer wins.