The only sure way is to see if they have male or female equipment. When they are very young it's impossible. But when they get older, around 2+ inches, then you can usually tell them apart. Of course, you would need access to a store that has older fish in stock and know what to look for.
There's lots online about this and looking at pictures can help, but I'd suggest only getting two to start with so that you can learn the difference. If you get one of each gender, then it will become obvious. If you get both of the same gender, then when you look in shops you will notice the ones that are different from what you already have.
Also, it's usually easy to pick a definite male. There's almost always a dominant male in the tank who is showing more color and attitude. Females are trickier because it's hard to tell a young male from a female. But if you spot a definite male in the store tank, look for another fish that seems to be hanging out with him. It's most likely a female. To do this, it's best to go to the store during off-peak hours so you can observe them when they are undisturbed.