How to randomize subset of array in Javascript?

后端 未结 4 1535
死守一世寂寞
死守一世寂寞 2021-01-25 18:22

What is the best way to randomize part of the array in Javascript

For example, if I have 100 items in the array, what is the fast and efficient way of randomizing set of

4条回答
  •  别那么骄傲
    2021-01-25 19:01

    I would split the 1 array into 10 subsets, then perform a shuffle algorithm of your choice on those subsets, and then recombine in the correct order.

提交回复
热议问题