Randomly fetch one item from a list without repetitions across multiple command calls

Asked Oct 24, 2020·2 replies·Last activity 5 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

hi i have over 1000 items in a list like

abcd;
efgh;
ijklm;

but the same item appears more often
here is my code

$(eval x = $(urlfetch json https://pastebin.com/raw/xxxx).split(";"); x[Math.floor(Math.random() * x.length)])

thank you

2 replies

I think, the function you want is not possible.

By the way, I would use $(count) variable. Like this...

First create an array ``[item1, item2, item3, ... item1000]`` in your pastebin.

Well it will give error if you use the command over 1000. But, for first 1000 calls, it will work fine and will return unique item.
I hope this will work

Hey @Gleeful Crab!

Your code is correct, don't change anything, each item is selected at random, having an item show up more often than the others is a regular behavior/impression when using true randomness.
You can read examples of this here or here.

The command @Maple Goose gave you is the exact same as yours and won't fix the issue.