How to randomize the reels in slot machine command?

Below is an example of a simple slot machine command. The odds of green are 50% on the first reel, 33% on the second reel and 25% on the third reel. How do I edit this command to randomize the order of the reels so that sometimes the 50% reel is in the second spot or third spot etc.

[ $(eval var sayings = ['🟩', "πŸŸ₯"]; sayings[Math.floor(Math.random() * sayings.length)];) | $(eval var sayings = ['🟩', 'πŸŸ₯', "πŸŸ₯"]; sayings[Math.floor(Math.random() * sayings.length)];) | $(eval var sayings = ['🟩', 'πŸŸ₯', 'πŸŸ₯', "πŸŸ₯"]; sayings[Math.floor(Math.random() * sayings.length)];) ]

several ways to do it, but this is first that came to mind…

$(eval let a=[['🟩',"πŸŸ₯"],['🟩','πŸŸ₯',"πŸŸ₯"],['🟩','πŸŸ₯','πŸŸ₯',"πŸŸ₯"]],b=[],c=0,d=[];while(c<a.length){b[c]=a[c][Math.floor(Math.random()*a[c].length)];c++};c=0;while(c<a.length){x=Math.floor(Math.random()*b.length);if(b[x]!=0){d[c]=b[x];b[x]=0;c++}};d.join(` | `))
2 Likes

This is great, thank you tiwosslave! I’ve been trying to complicate it by setting variable odds on each reel individually for rare jackpots like 1 in 10,000,000, but haven’t been able to accomplish it within 500 characters. The closest I was able to get was the code below which gives 1 in 10,000.

$(eval let a=[["⭐"],["⭐"],["$(eval satfact='$(urlfetch json https://paste.gg/p/anonymous/e919fa96dea64ccf956de88ff3756928)'.split(';'); satfact[Math.floor(Math.random() * satfact.length)];)"]],b=[],c=0,d=[];while(c<a.length){b[c]=a[c][Math.floor(Math.random()*a[c].length)];c++};c=0;while(c<a.length){x=Math.floor(Math.random()*b.length);if(b[x]!=0){d[c]=b[x];b[x]=0;c++}};d.join(` | `))

What I’m looking for is something like: the odds of a winning symbol on reel 1 is 1/10, reel 2 is 1/100 and reel 3 is 1/10000. If the random number generator selects the winning number for a reel, it takes from this array: [β€œ:star:”], and if it doesn’t hit the winning number for that reel, it will randomly select from this array: [β€˜:grapes:’, β€˜:melon:’, β€˜:watermelon:’, β€˜:tangerine:’, β€˜:lemon:’, β€˜:banana:’, β€˜:pineapple:’, β€˜:mango:’, β€˜:apple:’, β€˜:green_apple:’, β€˜:pear:’, β€˜:peach:’, β€˜:cherries:’, β€˜:strawberry:’, β€˜:blueberries:’, β€˜:kiwi_fruit:’, β€˜:tomato:’, β€˜:olive:’, β€œ:coconut:”]

do u mean in addition to the current functionality?.. or replace that with this new VERY RARE win version?

In addition. The reels have different rare probabilities to β€œhit” AND those reel positions are randomized every time.

oooo, fancy ^^ but i don’t see any way to integrate that with the current selection process… would either have to rework the whole thing or have a secondary process that would override the first one

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.