Hey y'all! Does anyone know how I could go about getting random locations from a config. So. I have my: Code (Text): for(String locations : filez.getConfigurationSection("Drop").getKeys(false)) { but I don't know how to simply randomly select them and broadcast them in chat. I know how to get them, but each time a want like 15 random locations (there is 30 in total). Any ideas? Thanks.
I'm not sure if this is the best way to do it, but it works: Put them in a list. Generate a random number and get the Location associated with that index from the list and remove that element from the list (with this method). Repeat this as many times as many random locations you need, but make sure there are enough in the config and you specify the right bounds for the RNG every time.
You either have to store the removed elements and repeat the task as many times as many random locations you want OR you remove random elements from the list until there are only as many left as many random locations you need. I believe the first method is the better one.