hi there! for some reason i can’t post on highlight discord?! anyway, here it is: does anyone know some good example of gen art on highlight using Fisher-Yates algo for shuffling? my code is producing something ‘almost ok’, but it is not perfect. and debugging is tricky w/o seed. i can share my code if someone is willing to help…thx a lot
you can test changing the seed via https://studio.highlight.xyz/ (change the transaction hash for eg.), or just by appending the ?&h=&tid= query params to the url of your local project
otherwise - if by chance you’re using Fisher Yates to exhaustively select from a list of seeds, you can probably just use the “Curated Seeds” feature instead
i am testing in studio too. so, i have : … let seedValue = hl.random(1, 1000000000);
// Create a shuffled sequence for 100 iterations
function createShuffledSequence() {
// Create array with 10 copies of each scene number (1-10)
let sequence = ;
for (let scene = 1; scene <= 10; scene++) {
for (let i = 0; i < 10; i++) {
sequence.push(scene);
}
}
// Simple Fisher-Yates shuffle using hl.random
for (let i = sequence.length - 1; i > 0; i--) {
const j = Math.floor(hl.random(0, i + 1));
[sequence[i], sequence[j]] = [sequence[j], sequence[i]];
}
return sequence;
}… but for some reason it does not behave perfectly. and somehow i decided against ‘curated seeds’ some time ago. maybe i should just reconsider it …tnx
Is the idea that there’ll be 100 tokens, 10 scenes, and 10 tokens of each scene? If so, I’d definitely consider curated seeds - just curate the 10 seeds you want and make sure each of them exists 10 times in the curated list. It handles this exhaustive approach across tokens. This is the best way to retain memory through the whole collection. Otherwise, you’d have to query the chain within your script, or make the collection fully onchain.
But if this is not the idea (100 tokens, 10 different versions, 10 tokens of each version), then I can take a look at your code
yes, this is an approximate idea, 10 scenes to appear in their different random formations 10 times each. i wouldn’t mind if it is at least close to that, but hl-gen.js is not giving me any predictability in its randomness (which is normal, i understand, but i really do not want to get some scene heavily picked up before some other ones). so, about that Curated Seeds version - is the collection hidden? minter can’t pick their own preference? also, can that ‘curated list of hashes’ be further made somehow ‘randomised’? if that is so, yeah, maybe i should just stop chasing my own tail, i am going in circles for a week or two now. thnx a lot
Yes, curated hashes aren’t gameable by minters. you curate a set of outputs you want, and the Highlight generative engine randomly picks a hash on each mint, exhausting the list - we use a version of Fisher-Yates under the hood.
I’d recommend just trying it out for yourself through the generative series flow:
You’d want to come with 10 hashes that correspond to your 10 scenes, and make sure each appears in the list 10 times. To test with these, just append &ic=1 to your local project url, and the hash passed in via &h= will be the curated hash you’d want to select.
Your script can be as simple as storing each of the 10 hashes and directly mapping each hash to each scene.
wait, wait, wait, can’t i make a list of 100 hashes? you got me confused here…i want 100 different outputs…and since i am curating, i maybe even want some scenes a bit more often than others…tnx
Yes, you can do that. I was just providing advice under the assumption each scene was the same. I’d highly recommend just playing with the feature.