JS takes 0-9 randomly taking 4 number non-repetitive digital code instances

This example, for everyone to share the specific code of JS to take 0-9 randomly to take four numbers, for everyone, the specific content is as follows

HTML

    SCRIPT 

Function F1 () {var arr_4 = New Array () Function Getrandom (min, max) // Start taking {// Random number var random = math.random () * (max-min) + min; // Take Random = Math.Fllor (Random); if (Arr_4.length
 The above is the JS of the small series to introduce the JS 0-9 randomly 4 digits non-repetitive digital detailed integration I hope to help everyone. If you have any questions, please leave a message, Xiaobian will reply to everyone in time. Thank you very much for your support for Tumi Cloud website!  < 4)							//判断数组长度
			{	
				for(i=0;i<=arr_4.length;i++)				//遍历数组。
				{
					if(random==arr_4[i])					//比较随机数
					{	
						break;
					}
					else								
					{
						if(i==arr_4.length)
						{arr_4.push(random);break;}
					}
				};
				getRandom(0,10);
			}
			
		}
		getRandom(0,10);		//随机取0-9
	alert(arr_4)
	}

                    
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment