Random playlist algorithm

后端 未结 12 1545
北恋
北恋 2020-12-09 04:58

I need to create a list of numbers from a range (for example from x to y) in a random order so that every order has an equal chance.

I need this for a music player I

12条回答
  •  感动是毒
    2020-12-09 05:40

    There are a number of methods of generating permutations without needing to store the state. See this question.

提交回复
热议问题