On Wed, Apr 7, 2010 at 5:05 AM, Aditya Mahajan <adit...@umich.edu> wrote: > On Tue, 6 Apr 2010, Wolfgang Werners-Lucchini wrote: > >> Hallo, >> >> I get allways (10 times at least) the same result: >> ------------------------------------------------------------- >> \starttext >> \startluacode >> math.randomseed(os.time()) >> \stopluacode >> >> Encode your Name and Surname as a >> \startluacode >> local a = {'null-terminated', 'dollar-terminated', 'Pascal'} >> context('%s string', a[math.random(1,3)]) >> \stopluacode >> \stoptext >> ------------------------------------------------------------- >> How can I randomize this? > > Hmm... which version are you using? I do get a ranom output each time. > Tested with 2009.12.31 and 2010.03.20. > > Since the math seed is set after \starttext, it should overwrite the value > after reading the tuc file.
Same here: # for j in `seq 1 100`; do context test.tex &> /dev/null; pdftotext test.pdf -|grep Encode; done >> out # nl out |tail -1 100 Encode your Name and Surname as a null-terminated string # grep 'Encode your Name and Surname as a Pascal string' out |nl|tail -1 33 Encode your Name and Surname as a Pascal string # grep 'Encode your Name and Surname as a dollar-terminated string' out |nl|tail -1 35 Encode your Name and Surname as a dollar-terminated string # grep 'Encode your Name and Surname as a null-terminated string' out |nl|tail -1 32 Encode your Name and Surname as a null-terminated string which is pretty good for only 100 samples -- luigi ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________