Create a random permutation of 1..N in constant space

前端 未结 6 721
旧巷少年郎
旧巷少年郎 2020-11-30 04:30

I am looking to enumerate a random permutation of the numbers 1..N in fixed space. This means that I cannot store all numbers in a list. The reason for that is that N can be

6条回答
  •  攒了一身酷
    2020-11-30 04:51

    Another way to do this is with a block cipher; see this blog post for details.

    The blog posts links to the paper Ciphers with Arbitrary Finite Domains which contains a bunch of solutions.

提交回复
热议问题