ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* randomize
@ 2010-04-05 22:21 Wolfgang Werners-Lucchini
  2010-04-05 22:49 ` randomize Wolfgang Schuster
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wolfgang Werners-Lucchini @ 2010-04-05 22:21 UTC (permalink / raw)
  To: ntg-context

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?

Wolfgang
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: randomize
  2010-04-05 22:21 randomize Wolfgang Werners-Lucchini
@ 2010-04-05 22:49 ` Wolfgang Schuster
  2010-04-07  3:05 ` randomize Aditya Mahajan
  2010-04-07  6:55 ` Context and psfrag Honza Pohanka
  2 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2010-04-05 22:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 06.04.10 00:21, schrieb Wolfgang Werners-Lucchini:
> 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?
>    
ConTeXt saves the random value in the tuc file to get the same output in 
each run.

Delete the tuc file with 'context --purgeall'.

Wolfgang

___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: randomize
  2010-04-05 22:21 randomize Wolfgang Werners-Lucchini
  2010-04-05 22:49 ` randomize Wolfgang Schuster
@ 2010-04-07  3:05 ` Aditya Mahajan
  2010-04-07  7:17   ` randomize Hans Hagen
  2010-04-07  7:45   ` randomize luigi scarso
  2010-04-07  6:55 ` Context and psfrag Honza Pohanka
  2 siblings, 2 replies; 6+ messages in thread
From: Aditya Mahajan @ 2010-04-07  3:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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.

Actually, I consider saving the random number in tuc file to be a 
misfeature. A random sequence generator should generate a random sequence. 
If I want the same behavior all the time, I can use 
\setupsystem[random=12345] (which should also set 
math.randomseed).

Aditya
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Context and psfrag
  2010-04-05 22:21 randomize Wolfgang Werners-Lucchini
  2010-04-05 22:49 ` randomize Wolfgang Schuster
  2010-04-07  3:05 ` randomize Aditya Mahajan
@ 2010-04-07  6:55 ` Honza Pohanka
  2 siblings, 0 replies; 6+ messages in thread
From: Honza Pohanka @ 2010-04-07  6:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello,
is there please any equivalent for LaTeX psfrag package (it can replace  
the text in eps images)?


greetings
Jan Pohanka
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: randomize
  2010-04-07  3:05 ` randomize Aditya Mahajan
@ 2010-04-07  7:17   ` Hans Hagen
  2010-04-07  7:45   ` randomize luigi scarso
  1 sibling, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2010-04-07  7:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 7-4-2010 5:05, Aditya Mahajan 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.
>
> Actually, I consider saving the random number in tuc file to be a
> misfeature. A random sequence generator should generate a random
> sequence. If I want the same behavior all the time, I can use
> \setupsystem[random=12345] (which should also set math.randomseed).

the reason is that otherwise (esp if the randomization produced 
different input, graphic sizes, etc) you can get oscilation and endless 
runs due to never quite right multipass data which is pretty hard to debug

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: randomize
  2010-04-07  3:05 ` randomize Aditya Mahajan
  2010-04-07  7:17   ` randomize Hans Hagen
@ 2010-04-07  7:45   ` luigi scarso
  1 sibling, 0 replies; 6+ messages in thread
From: luigi scarso @ 2010-04-07  7:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, Apr 7, 2010 at 5:05 AM, Aditya Mahajan <adityam@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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-04-07  7:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-05 22:21 randomize Wolfgang Werners-Lucchini
2010-04-05 22:49 ` randomize Wolfgang Schuster
2010-04-07  3:05 ` randomize Aditya Mahajan
2010-04-07  7:17   ` randomize Hans Hagen
2010-04-07  7:45   ` randomize luigi scarso
2010-04-07  6:55 ` Context and psfrag Honza Pohanka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).