Unique Random Numbers

Visit Publisher Site
Unique Random Numbers Hosting Promo

Sponsored by TMDHosting

This JavaScript picks up a number of unique random elements from an array. For example; if you have an array myArray consisting of 10 elements and want to pick 5 unique random elements. Suppose initially myArray[3] is picked randomly, then myArray[3] should not be picked again. If you want to pick 4 numbers, call the function like: pickNums(4).

Visit publisher site: Unique Random Numbers
  • Thanks for your rating. Consider leaving a review and let others know more about your experience. Add ReviewClose
    Rated 1.00 out of 5 (1 rating)
  • 1 Member Reviews
  • Views: 2,930
  • Price: Free

Listing Details

Filed in:
Scripts / JavaScript / Scripts & Programs / Randomizing / Combination
Submitted on:
Last Updated:
Other listings by this publisher

License & Pricing Information

User Reviews 

Add/Edit Your Review
Average Member Rating: 1.00/5

Displaying 1-1 out of 1 reviews

  • An extremely long way around way to do it when sorting the array into random order and then reading the resultant entries sequentially can be done in two lines of code. myArray = new Array('1','2','3','4','5' ,'6'); // code to randomize array follows function randOrd(){return (Math.round(Math.random() )-0.5); } myArray.sort( randOrd ); // and from here you just read as many random selections you want from the front of the array.

See all 1 reviews for Unique Random Numbers