#!/usr/local/bin/pike// -*- mode: pike -*- // $Id: random.pike,v 1.13 2001/05/08 06:35:56 doug Exp $ // http://www.bagley.org/~doug/shootout/ int IM = 139968; int IA = 3877; int IC = 29573; int last = 42; float gen_random(float max) { return(max * (last = (last * IA + IC) % IM) / IM); } int main(int argc, array(string) argv) { float result = 0; int N = (int)argv[-1] || 1; while (N--) { result = gen_random(100.0); } write("%.9f\n", result); return(0); }