*** /usr/torrent/mercury-compiler-0.13.1/library/random.m	Mon Jul 31 15:01:56 2006
--- random.m	Tue Feb 13 08:19:41 2007
***************
*** 53,56 ****
--- 53,57 ----
  
  :- import_module list.
+ :- import_module io.
  
  	% The type `random.supply' represents a supply of random numbers.
***************
*** 63,66 ****
--- 64,73 ----
  :- pred random.init(int::in, random.supply::uo) is det.
  
+ 	% random.init(RS, !IO): creates a supply of random numbers RS
+ 	% using a sensible default seed (e.g., on POSIX it will use
+ 	% the number of seconds since the unix epoch.)
+ 	%
+ :- pred random.init(random.supply::uo, io.io::di, io.io::uo) is det.
+ 
  	% random.random(Num, RS0, RS): extracts a number Num in the
  	% range 0 .. RandMax from the random number supply RS0, and
***************
*** 134,137 ****
--- 141,153 ----
  random.init(I0, rs(RS)) :-
  	copy(I0, RS).
+ 
+ random.init(rs(RS), !IO) :-
+ 	random.foreign_init(RS, !IO).
+ 
+ :- pred random.foreign_init(int::uo, io.io::di, io.io::uo) is det.
+ :- pragma foreign_decl("C", "#include <time.h>").
+ :- pragma foreign_proc("C", random.foreign_init(X::uo, IO0::di, IO::uo),
+ 		[will_not_call_mercury, thread_safe, promise_pure],
+ 		"X = time(NULL); IO = IO0;").
  
  random.random(I, rs(RS0), rs(RS)) :-
