我希望能够在下面的 SQL 表中计算 16 位整数(id 和运动)的随机性。有没有人有一个很好的简单建议。
理想情况下,结果应该只显示给定单个源 IP 地址的运动和 id 号码的随机性。如果需要,逻辑可以完全在 SQL 之外。作为具有上限的纯整数,这样做应该是合理的快速性能 - 我认为
mysql> select * from packets limit 12;
+---------------------+-----------+------------+-------+-------+--------+-------+
| stime | sip | dip | sport | dport | in_out | id |
+---------------------+-----------+------------+-------+-------+--------+-------+
| 2012-12-28 15:12:54 | 167837969 | 3406501129 | 26008 | 53 | 1 | 27205 |
| 2012-12-28 15:12:54 | 167837969 | 3406501129 | 19066 | 53 | 1 | 12517 |
| 2012-12-28 15:12:54 | 167837969 | 3406501129 | 4262 | 53 | 1 | 17233 |
| 2012-12-28 15:12:54 | 167837969 | 3406501129 | 881 | 53 | 1 | 12689 |
| 2012-12-28 15:12:54 | 167837969 | 3406501129 | 31211 | 53 | 1 | 7485 |
| 2012-12-28 15:12:54 | 167837969 | 3406501129 | 14834 | 53 | 1 | 2299 |
| 2012-12-28 15:12:54 | 167837969 | 3406501129 | 15458 | 53 | 1 | 7923 |
| 2012-12-28 15:12:54 | 167837969 | 3406501129 | 8192 | 53 | 1 | 8490 |
| 2012-12-28 15:12:54 | 167837969 | 3406501129 | 31909 | 53 | 1 | 30410 |
| 2012-12-28 15:12:54 | 167837969 | 3406501129 | 3482 | 53 | 1 | 2602 |
| 2012-12-28 15:12:54 | 167837969 | 3406501129 | 23597 | 53 | 1 | 8713 |
| 2012-12-28 15:12:54 | 167837969 | 3406501129 | 13165 | 53 | 1 | 22742 |
+---------------------+-----------+------------+-------+-------+--------+-------+