package main import ( "mae.earth/pkg/numcat/catalogue" "mae.earth/pkg/numcat/random" "fmt" "os" ) const ( TOTAL int = 100 ) func main() { /* read the catalogue */ reader := catalogue.New() /* create a random tool */ tool,err := random.New(reader) if err != nil { fmt.Fprintf(os.Stderr,"error creating random tool from catalogue -- %v\n",err) os.Exit(1) } for i := 0; i < TOTAL; i++ { n,err := tool.Normal() if err != nil { fmt.Fprintf(os.Stderr,"error requesting normal from random tool -- %v\n",err) os.Exit(2) } u,err := tool.Uniform() if err != nil { fmt.Fprintf(os.Stderr,"error requesting uniform from random tool -- %v\n",err) os.Exit(2) } fmt.Fprintf(os.Stdout,"%05d/%05d\t%f\t%f\n", i + 1, TOTAL, n, u) } }