Your question doesn't state which game, but Smogon university has a DPP/Emerald Secret ID calculator. It's super confusing and totally not worth doing in my opinion, but you can use your Secret ID to breed or capture Pokemon and determines the shininess of Pokemon without a cheating device using certain methods and calculators that the game goes through.
The Secret ID number is also used to create more variance in games with a second number for when two trainers should have the same Trainer ID, but not the same individual Secret ID.
From Generation III onward, there is a second, secret ID number, different from the visible one. This number exists purely to make sure that even if two Trainers share the exact same name and gender and the exact same Trainer ID number, the game will still recognize their Pokémon as coming from different Trainers. Usually, this number cannot be viewed; however, certain cheating devices can be used to view it. It also comes into play along with the normal ID number and the personality value in determining if a Pokémon is Shiny. If two different Trainers have the same Trainer name, identical ID numbers and identical hidden ID numbers (a 1 in 4,294,967,296 chance if the names do not differ), the game will recognize the two Trainers as the same, so the Pokémon are not considered to be outsider Pokémon. - Bulbapedia