DFortune

git clone git://xatko.vsos.ethz.ch/DFortune.git
Log | Files | Refs | README

randomFortune.d (284B)


      1 import dfortune;
      2 import std.stdio;
      3 import std.random;
      4 
      5 int main(string args[]){
      6 	Fortunes f;
      7 	if(args.length==1){
      8 		writeln("Usage: "~args[0]~" /path/to/fortune[/path/to/other/fortunes,...]");
      9 		return 1;
     10 	}
     11 	f.add(args[1..$]);
     12 	writeln(f.strings.randomSample(1).front);
     13 	return 0;
     14 }