Thank you for the function. Unfortunately did not work :)
Godot marked the use of 'seed' in a for loop as an error. I renamed it to another word that is not taken (seede).
When running the function, I got a nonsensical result:
RESULTS 2:[0, 0, 0, 0]
RESULTS 2:[1, 0, 0, 0, 0]
RESULTS 2:[2, 0, 0, 0, 0, 0]
RESULTS 2:[0, 1, 0, 0, 0, 0, 0]
RESULTS 2:[1, 1, 0, 0, 0, 0, 0, 0]
RESULTS 2:[2, 1, 0, 0, 0, 0, 0, 0, 0]
RESULTS 2:[0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
RESULTS 2:[1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
RESULTS 2:[2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
RESULTS 2:[0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
RESULTS 2:[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
RESULTS 2:[2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
RESULTS 2:[0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
RESULTS 2:[1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
RESULTS 2:[2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
RESULTS 2:[0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
RESULTS 2:[1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
RESULTS 2:[2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
In any case, I solved this by writing my own function that generates a custom for loop script, which it then runs. It's an ugly hack, but it works at least. :D I suggested this feature being added to godot at the bug tracker and Bogdan seems to have liked it.
Maybe some of the future versions will have a cleaner approach to this challenge