Random slot algorithm

后端 未结 4 1498
执念已碎
执念已碎 2020-11-27 08:35

I have two dimensional array. I want to pick a slot at random, and continue to do so never picking the same slot twice until I have finally picked all slots (so nothing ran

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 08:58

    Take a look at the Fisher-Yates shuffle. It's designed to pick a random permutation from a set.

提交回复
热议问题