class MAKEPOINTS creation go feature go is local x, y : REAL i, count : INTEGER rand : STD_RAND pair : GBN_KEYED_PAIR [REAL, REAL] heap : GBN_HEAP [ GBN_KEYED_PAIR [REAL, REAL] ] do -- this part is the nasty part if (argument_count /= 1 and argument_count /= 2) or else (not argument(1).is_integer) or else (argument_count = 2 and then not argument(2).is_integer) then std_error.put_string(argument(0) + " expects integer args: count and optional seed%N") else count := argument(1).to_integer if argument_count = 2 then !! rand . with_seed ( argument(2).to_integer ) else !! rand . make end -- this part is the nice part !! heap . make from i := 1 until i > count loop rand . next x := rand . last_real rand . next y := rand . last_real !! pair . make ( x ) pair . put ( y ) heap . add ( pair, Void ) i := i + 1 end from io . put_integer ( heap.count ) io . put_new_line until heap . is_empty loop pair := heap . min io . put_real ( pair . key ) io . put_character (' ') io . put_real ( pair . item ) io . put_new_line heap . delete_min end end -- if valid arguments end -- routine go end -- class MAKEPOINTS