# $Id: random.parrot,v 1.0 2002/08/19 17:18:00 dada Exp $ # http://dada.perl.it/shootout/ .constant IM 139968 .constant IMf 139968.0 .constant IA 3877 .constant IC 29573 .constant LAST I10 set .LAST, 42 set I1, P0[1] while: set N0, 100 bsr gen_random dec I1 if I1, while print N0 end gen_random: #last = (last * IA + IC) % IM; #return( max * last / IM ); mul I11, .LAST, .IA add I11, .IC cmod .LAST, I11, .IM set N10, .LAST mul N11, N0, N10 div N0, N11, .IMf ret