ps I called it like Random
, but this is a random seed-based random case where the seed will be generated by PRNG, but with the same seed the same “random” distribution will be observed.
I'm currently trying to find a way to help do 2 things:
1) Non-repeating sequence generation
This will require 2 arguments Seed
; and N
. It will generate a sequence of size N
filled with numbers between 1
and N
without repetition.
I have found some good methods for this, but most of them come up with feasibility in the second part.
2) Extract a record from a sequence
It takes 3 arguments Seed
; N
; and I
. This is to determine which value will be displayed in the position I
in the sequence to be generated with Seed
and N
. However, in order to work with what I mean, he absolutely cannot use the generated sequence and select the element.
At first I worked with preliminary calculation of the sequence, then I requested it, but it really only works in test cases, since the number Seeds
and value N
that will be used will create the database in Petabytes.
From what I can say, a method that implements requirement 1 using requirement 2 would be the most ideal method.
i.e. the sequence is generated:
function Generate_Sequence(int S, int N) {
int[] sequence = new int[N];
for (int i = 0; i < N; i++) {
sequence[i] = Extract_From_Sequence(S, N, i);
}
return sequence;
}
Example
GS = Generate Sequence
ES = Extract from Sequence
for:
S = 1
N = 5
I = 4
GS(S, N) = { 4, 2, 5, 1, 3 }
ES(S, N, I) = 1
let S = 2
GS(S, N) = { 3, 5, 2, 4, 1 }
ES(S, N, I) = 4