Divine Algorithm for Class Gossip

Saw this on Bilibili, av1020723 . I might create a PHP version later. The original program was in Java and wouldn't run on my computer (unknown reason). I translated the source code to Pascal. Java version: Program: http://pan.baidu.com/s/1sjtZs1v Source code: http://pan.baidu.com/s/1ntmFSLV Pascal version source code: uses math; type relation= record p: longint ; q: longint ; end ; var i,boy,girl,total,count: longint ; boylove,girllove:float; cpresult:relation; //Union variables id,sz,lead: array [ 0 . .10000 ] of longint ; //Simulate Java bernoulli function function possibility (maybe:float): boolean ; var i: longint ; begin i:=random( 10000 ); if (i>maybe* 10000 ) then exit ( false ) else exit ( true ); end ; //Pairing function cp (i: integer ):relation; var j:float; begin cp.p:=i; j:...