dimanche 7 février 2016

Generating a non-repeating set from a random seed, and extract result by index

I am currently trying to find a method to assist in doing 2 things:

1) Generate Non-Repeating Sequence

This will take 2 arguments: Seed; and N. It will generate a sequence, of size N, populated with numbers between 1 and N, with no repetitions.

I have found a few good methods to do this, but most of them get stumped by feasibility with the second thing.

2) Extract an entry from the Sequence

This will take 3 arguments: Seed; N; and I. This is not for generating a sequence, and in order to work with what I have in mind, absolutely cannot (due to time). But, what this will do, is it will determine the number at position I in the random sequence, that would be created before.

I initially worked with pre-calculating the sequence, then querying it, but this only really works in test cases, as the number of Seeds, and the value of N that will be used would create a database into the Petabytes.




Aucun commentaire:

Enregistrer un commentaire