jquery 如何递归的改变表格数据?

我有一个表格,上面写着数字,如果是某一个数就替换成一个随机数,
而且此随机数如果随机到这个数字再一次替换成随机数,如果还有再替换,直到没有这个数为止
这样的代码怎么写呢?

var temp = 222;//某一数字
$("#tableid>td").each(functioni(){
if($(this).html() == temp){
$(this).html(sjs_fun());
}
});
//生成随机数,并且不能是指定数字。这里生成的是10以内的
fucntion sjs_fun(){
var sjs = Math.round(Math.random()*10);
if(sjs == temp){
return sjs_fun();

}else{
return sjs;
}
温馨提示:答案为网友推荐,仅供参考