NAT how port numbers are chosen when using PAT

When using Port Address Translation (PAT), also known as NAT overloading, the NATting procedure attempts to assign the same port value as the original request. If the original source port is already in use, it will begin scanning from the beginning of the particular port range it is using to find the first available port and assigns it to the conversation.

For more information about the dividing of available ports that PAT enforces take a look at PAT (overloading) maximum number of translations per inside global address

Links:

https://www.cisco.com/c/en/us/support/docs/ip/network-address-translation-nat/26704-nat-faq-00.html