|
|
Combination
JavaScript » Scripts and Programs » Randomizing » Combination
A D V E R T I S E M E N T
Want free Oracle Magazine? Apply here now!
Random quotes/images/banners or any thing - FreeA Random Quote on your home page may bring some surprise to newbies. The script given below uses Math.random() function of JavaScript to generate a unique number which lies from 0 to the length of an array which stores the quotes. Then just prints them. Simple enough. Try it. Unique Random NumbersThis 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). Unique Random SetsThis JavaScript, based on Unique Random Numbers II, picks Unique Random Sets. Here, there are more than one arrays (need not be of same length). First, we pick a number of unique random elements from the first array, numArr1 to form the array pickArr1. Now each element of pickArr1 picks another element from the second array numArr2, which again is unique and random. Thus we form the array pickArr2. Similarly each element of pickArr2 picks unique random elements from numArr3 to form pickArr3. Ace Random Banners - FreeA very simple script to display random banners and links on your web site.
|
A D V E R T I S E M E N T
|
Subscribe to SourceCodesWorld - Techies Talk |
| |
|