0xb9eddce6…9dfbsent to0x7c3ea2b7…0b18·#17,187,041·view on Etherscan
function fisherYatesShuffle(seed,array){let currentIndex=array.length;let temporaryValue,randomIndex;while(currentIndex!==0){randomIndex=(seed+currentIndex)%currentIndex;currentIndex-=1;temporaryValue=array[currentIndex];array[currentIndex]=array[randomIndex];array[randomIndex]=temporaryValue}
return array}
function generateIndices(seed,totalImages){const array=Array.from({length:totalImages},(_,i)=>i+1);return fisherYatesShuffle(seed,array)}
function selectImage(tokenId,totalImages=100){const seed=648137;const indices=generateIndices(seed,totalImages);console.log(`tokenId: ${tokenId}`)
console.log(`Selection: ${indices[tokenId % totalImages]}`)
return indices[tokenId%totalImages]}
const selectedImage=selectImage(tokenData.tokenId);let img;function preload(){img=loadImage(`https://pinata.brightmoments.io/ipfs/QmXbRMfkCXcD5Zj1S1qb4UYy66x76471kibabjcaTkP7j3/${selectedImage}.jpg`)}
function setup(){createCanvas(windowWidth,windowHeight)}
function draw(){background(0);let imgAspectRatio=img.width/img.height;let newWidth=width;let newHeight=newWidth/imgAspectRatio;if(newHeight>height){newHeight=height;newWidth=newHeight*imgAspectRatio}
let x=(width-newWidth)/2;let y=(height-newHeight)/2;image(img,x,y,newWidth,newHeight)}
function windowResized(){resizeCanvas(windowWidth,windowHeight)}