How does nmap calculate the difficulty of TCP sequence prediction?

Solution 1:

The topic of TCP sequence prediction is covered pretty well in the online Nmap book's OS detection page under "TCP Sequence Prediction." Essentially, statistical methods such as the Greatest Common Denominator (GCD) are used to predict the sequence's variability. There is more discussion on the OS detection methods page, and you can look at the code in osscan2.cc in the HostOsScan::makeTSeqFP function.