13 Mar
2012
13 Mar
'12
3:58 p.m.
Hi all,
scenario: for a presentation, I want the background to be a random picture, taken from a directory "backgroundpics." The pictures are numbered consecutively as 1.jpg through 22.jpg. For some complex reasons, it would be easier for me to include these pictures via metafun (I want to add other graphical elements on top). So my question is, how can I pick a random picture? Given the code
StartPage ; draw externalfigure "backgoundpics/1" xscaled PaperWidth yscaled PaperHeight ; StopPage ;
how can I obtain a random number and make metapost pick the corresponding picture? Sorry, difficult to make a minimal example here...
(Untested) draw externalfigure ("backgroundpics/" & round(uniformdeviate(22)+1)) Aditya