Re: [NTG-context] random background picture in metafun

2012-03-15 Thread Thomas A. Schmitz
On 03/13/2012 07:24 PM, Peter Rolf wrote: Actually, round (uniformdeviate(nopics-1)) does not give equal weightage to 1 and nofpics. A better solution is n:= floor(uniformdeviate(nofpics)) + 1; :-) I used 'floor' in my prior tests, but changed it to 'round' because of the very small

Re: [NTG-context] random background picture in metafun

2012-03-15 Thread Hans Hagen
On 15-3-2012 10:18, Thomas A. Schmitz wrote: On 03/13/2012 07:24 PM, Peter Rolf wrote: Actually, round (uniformdeviate(nopics-1)) does not give equal weightage to 1 and nofpics. A better solution is n:= floor(uniformdeviate(nofpics)) + 1; :-) I used 'floor' in my prior tests, but changed

Re: [NTG-context] random background picture in metafun

2012-03-15 Thread Thomas A. Schmitz
On 03/15/2012 07:06 PM, Hans Hagen wrote: Ah, but keep in mind that the random number is stored in the tuc file! So, as long as that file is not wiped, you get the same random number initialization. Imagine what would happen if we would not do that. So, just erase the tuc if you want another

[NTG-context] random background picture in metafun

2012-03-13 Thread Thomas A. Schmitz
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

Re: [NTG-context] random background picture in metafun

2012-03-13 Thread Aditya Mahajan
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

Re: [NTG-context] random background picture in metafun

2012-03-13 Thread Peter Rolf
Am 13.03.2012 15:45, schrieb Thomas A. Schmitz: 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

Re: [NTG-context] random background picture in metafun

2012-03-13 Thread Thomas A. Schmitz
On 03/13/2012 05:33 PM, Peter Rolf wrote: string mypath, rndfile; mypath:= backgroundpics/; nofpics:= 22; n:= round(uniformdeviate(nofpics-1)+1); rndfile:= mypath decimal n; HTH, Peter Aditya, Peter, thank you both for your quick replies! Peter's works wonderfully; Aditya's untested

Re: [NTG-context] random background picture in metafun

2012-03-13 Thread Thomas A. Schmitz
On 03/13/2012 05:56 PM, Thomas A. Schmitz wrote: thank you both for your quick replies! Peter's works wonderfully; Aditya's untested code throws an error ! Not implemented: (string)(known numeric). I guess this is too arcane for the wiki? To clarify: I wasn't talking about the error, which is

Re: [NTG-context] random background picture in metafun

2012-03-13 Thread Aditya Mahajan
On Tue, 13 Mar 2012, Peter Rolf wrote: Am 13.03.2012 15:45, schrieb Thomas A. Schmitz: 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

Re: [NTG-context] random background picture in metafun

2012-03-13 Thread Peter Rolf
Am 13.03.2012 19:00, schrieb Aditya Mahajan: On Tue, 13 Mar 2012, Peter Rolf wrote: Am 13.03.2012 15:45, schrieb Thomas A. Schmitz: Hi all, scenario: for a presentation, I want the background to be a random picture, taken from a directory backgroundpics. The pictures are numbered