How the canister id is generated

There are similar questions here, but no one is answering them.

So,Can you find the rules for subnet ID allocation? I need help.

Here I found out how to generate canisterid