How to pick a random number from an array?

Hey VigeoJames-

Are you trying to do this in blueprints or in code? You should be able to create a variable to store a random number between 0 and 4. Then when you call the array, use the variable to select which array element you want to use. Depending on how your setup is you should be able to have it pick a new random number each time you call the blueprint/function.

Cheers

I have an array with 5 spawn points in it. How can I have it that when it spawns it picks one of those arrays and spawns it there? It’s going to do this every 2 seconds so I should be getting a different spawn point most everytime. Thanks

All of this is done in blueprints. I know how to do it with a random integer but I was hoping there was a faster way of doing it. I can just have it it randomize a number, if its 1 go here, if its 2 go here, etc… I just didnt know if there was a quicker way. Thanks!

1 Like