Want to hire a development team?
No Images Added Yet

Unique Random Numbers

Rated1.0/5 (1 ratings)
Add to Favorites
Publisher
JavaScript to pick up a number of unique random elements from an array.
Product Details

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).

Report this Listing
Price
Free
Licence Type
Free
Views
3,948
Submitted on
6th August 2002
Last Updated
11th February 2009
Advertisement The banner below is an advertisement
Quikwit - AI Chatbot Platform

You May Also Like

Cloud Services You May Like

Help/Fix on identifying the most cost effective AWS spot instances based on instance type and region (1 Hour)

One hour of help to choose the most cost effective AWS Spot instances for your workload.

Automating AWS Server Backups and configuring AWS Backup Cycles and AWS Backup rules

Set up automated backups for AWS servers using AWS Backup and clear backup cycles.

Monitoring Spot Instance Prices and Migrating Instances to Optimal Types/Regions

Automatically monitoring AWS Spot instance prices and moving servers to better instance types or regions for maximum sav

Cost optimization by archiving standard AWS snapshots

Reduce storage costs by cleaning up and archiving old EC2 or EBS snapshots safely.

User Reviews

Please rate the listing and tell the world know what do you think about the listing.
(1 ratings)
Average User Rating: 1.0/5
Very long winded code.
Reviewed byAnonymousonMon, 17th April 2006
Rating 1 - Poor
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.
Displaying 1-1 out of 1 reviews
View All Reviews