[metapost] Re: a "randomseed" workaround

Larry Siebenmann laurent at math.toronto.edu
Mon Mar 7 07:40:17 CET 2005



Karl and others!

Some quick reactions:

 KB> Taco, if it's allowed to be system-dependent, then how 
 > about using /dev/random on systems that support it?  That 
 > would be much, much, more random than just using the 
 > current time.  (There might be better things than 
 > /dev/random these days, for that matter; a lot of work has 
 > gone into this topic, since ssh and other crypto 
 > applications need randomness.)

A good comment to go into web files for implementors.

 LS> It would be helpful to add to mp documentation a fairly complete
 > table of primitives that are common to mf and mp.

 KS> No question.  It would also be helpful to write a 
 KS> completely new MP manual...

Such a table is not just desirable but a *reasonable* task 
for a fledging mp expert.  I would hope many programmers
reading this are more competent than I am or Karl.
I expect Hobby and confirmed experts like Jacko would 
check it out.

Incidentally, such a table could be readily enhanced for mf users.

 KB> The current doc is available from sarovar (Larry, you 
 > asked me about this separately).  You can get it through 
 > CVS (http://sarovar.org/projects/metapost/), or directly 
 > from the web: 
 > http://cvs.sarovar.org/cgi-bin/cvsweb.cgi/doc/?cvsroot=met
 > apost 

If you were to maintain a current ".pdf" beta version of the 
mp documentation, listmembers would provide a max of 
comments/corrections with a min of effort.

 LS> It took me quite a while to locate the conversion
 > from string to numeric by "scantokens" (see below).

 KB> I'm not sure what I'm supposed to see below?  
 > Sorry, I guess I don't know mp well enough 
 > to extract the meaning here.

I was referring to the line:

          seed_adjuvant:= scantokens(str); %% (*)

where str is a string (in fact a decimal represented integer) 
that arose as 

          str:= readfrom"SeedBank";

"scantokens" is a strange syntax for a type conversion.
It's a more general low level operation for mf and etex.
"decimal" converts back from numeric to string.  

    LS> %% Default for metafont is (in effect)
    > %% randomseed:= day + time*epsilon

I was more-or-less quoting the mf book, qv.

 > This in itself is a useful thing to put in the manual, 
 > so I'll do that.

Except that time is in minutes, whence misbehavior of randomseed.
Seems more suitable for web source.

Cheers

Laurent S.





More information about the metapost mailing list