I have a timer that gives shoutouts to 2 streamers from my clan every so often. At the moment it just picks a random line from a file twice, but that does sometimes pick the same line twice.
imGlitch imGlitch Why not follow $(eval a=`$(urlfetch json https://zoeballz.tv/nb/REBORN.txt)`.split(`#`);a[Math.floor(Math.random()*a.length)]) and $(eval a=`$(urlfetch json https://zoeballz.tv/nb/REBORN.txt)`.split(`#`);a[Math.floor(Math.random()*a.length)]) who are World of Tanks streamers and members of REBORN :) imGlitch imGlitch
Is there a simple way within the command line to make sure it doesn’t shoutout the same person twice please ? Or do I need to write an API to do it ?
(I don’t know JS !)
It is possible to avoid repeats with JS, using the splice function to remove the first streamer from the list after they have been chosen:
imGlitch imGlitch Why not follow $(eval a=`$(urlfetch json https://zoeballz.tv/nb/REBORN.txt)`.split(`#`);x1=a.splice(Math.floor(Math.random()*a.length), 1)[0];x2=a[Math.floor(Math.random()*a.length)];x1 + " and " + x2) who are World of Tanks streamers and members of REBORN :) imGlitch imGlitch
This also has the advantage of only loading the text file once! Hope it works well for you