How to choose a set of unique random numbers (no duplicates) using the jQuery.inArray method?
问题 This is a Javascript / jQuery question: I'm trying to generate six unique random numbers between 1 and 21 (no duplicates), using the jQuery.inArray method. Those six numbers will then be used to select six .jpg files from a group named logo1.jpg through logo21.jpg. Can anyone tell me what I'm doing wrong here? <div id="client-logos"></div> <script src="http://code.jquery.com/jquery-1.5.js"></script> <script type="text/javascript"> Show = 6; // Number of logos to show TotalLogos = 21; // Total