I've been puzzling myself for around 5 hours now. I'm extremely new to Golang (2 day)...
I'm looking for a for loop that will create all permutations of a given sized string, using specific characters. Not only that, but it needs to be split into specific chunk sizes.. I'll try and visually show you what I need..
chars := "abcdefghij"
string_size := 6
blocks := 5
start_position := 2
So the possibilities of this example would be 10 to the power of 6... so 1,000,000..
What I need is for this e.g. 1,000,000 to be split into 5 blocks mentioned above, so 200,000 guesses per for loop.
So specifying start position would lets say do something like
sections_usable := len(chars) / blocks
// sections_usable == 5
// this would then cherry pick 5 sections
sections := make([]rune, blocks)
base_count := 0
for i := 0; i < blocks * sections_usable; i = i + sections_usable {
sections[base_count] = rune(r[i])
base_count++
}
for i, xi := range x {
if i == 0 {
// This is where its selecting the starting character
// From the sections
p[i] = sections[block_to_use]
} else {
p[i] = r[xi]
}
}
Heres an example of what data I'd want returned using
chars := "abcdefghij"
string_size := 6
blocks := 5
start_position := 2
So start position 0 would be "a", 1 would be "c", 2 would be "e"
so using 0
aaaaaa
aaaaab
aaaaac
aaaaad
....
abbbbb
abbbbc
abbbbd
....
acdddd
acddde
acdddf
NOW USING start position 2
eaaaaa
eaaaab
eaaaac
...
And so on, but the permutations must stop before it starts the next block i.e
ejjjjj