Hi how can i randomnize the index of this array?
var arr = new Array("0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20");
i want to return the index of the array randomnly. Any help?
Hi how can i randomnize the index of this array?
var arr = new Array("0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20");
i want to return the index of the array randomnly. Any help?
@techyworld
Hi how can i randomnize the index of this array?
Read this Now Fisher-Yates in JavaScript:
I want it to generate the number only one.Fisher-Yates will do it? Because next time it regenerates, it should not give me the number it produced at start
@techyworld
I want it to generate the number only one.Fisher-Yates will do it? Because next time it regenerates, it should not give me the number it produced at start
The link I provide is to generate random arrays so every numbers appears in the array.
You want to generate a random number in the array but only one number appear? In order to do that you need to create a if & else statement.
Nope lets say i have an array of 5 elements. index of array = 0,1,2,3,4
it generates a random index like 3. after generating this number, it should delete index 3 in the array. so next time it regenerates it has only this index left = 0,1,2,4. the third element is removed