Re: [NTG-context] randomize direction of arrow in metafun

2021-05-15 Thread Thomas A. Schmitz
On 5/15/21 2:42 PM, Mikael Sundqvist wrote: Hi, you could do something like this: \startMPpage for i = 0 upto 10: drawarrow if uniformdeviate(1)<0.5: reverse fi ((0,0)--(2cm,0)) yshifted i*cm; endfor; \stopMPpage /Mikael Hi Mikael, wonderful, thanks for the quick answer! Yes that works

Re: [NTG-context] randomize direction of arrow in metafun

2021-05-15 Thread Mikael Sundqvist
Hi, you could do something like this: \startMPpage for i = 0 upto 10: drawarrow if uniformdeviate(1)<0.5: reverse fi ((0,0)--(2cm,0)) yshifted i*cm; endfor; \stopMPpage /Mikael On Sat, May 15, 2021 at 2:30 PM Thomas A. Schmitz wrote: > > Hi all, > > for a slide template, I want to draw

[NTG-context] randomize direction of arrow in metafun

2021-05-15 Thread Thomas A. Schmitz
Hi all, for a slide template, I want to draw colored arrows in a randomized color (from a list of colors). This works (and the code is far too clever for me, I must have copied it somewhere): save mycolor ; color mycolor[] ; mycolor[1] := (0.2, 0.3, 0.4) ; mycolor[2] := (0.6, 0.6, 0.4) ;

Re: [NTG-context] Randomize order of blocks

2021-01-06 Thread Jairo A. del Rio
Nice. I had something a little bit different in mind, but your examples gave me some ideas, especially the shuffling stuff. If I have something new to add, I will share my results with the list. Thank you a lot. Best regards, Jairo El mié, 6 de ene. de 2021 a la(s) 03:56, Otared Kavian

Re: [NTG-context] Randomize order of blocks

2021-01-06 Thread Otared Kavian
Following up my previous message, here is an example: %% begin shuffled list of exercises \setuprandomize[2021] \startluacode function shuffle(tableau) local maxsize, t, tt maxsize = #tableau tt = {} t = {}

Re: [NTG-context] Randomize order of blocks

2021-01-06 Thread Otared Kavian
Hi Jairo, One can indeed make quizzes and exams with randomized order of problems, randomized values and even randomized names of functions and variables. I have some examples which I have been using for several years (they are useful especially in these days of giving exams online…): I can

[NTG-context] Randomize order of blocks

2021-01-05 Thread Jairo A. del Rio
Hi, list. Some time ago I realized ConTeXt has "blocks" which allow one to make quizzes, exams and related with ease. However, I want to know if there's an option to randomize their order when printed. Thank you in advance. Jairo

Re: [NTG-context] Randomize control points in metapost/metafun?

2016-08-01 Thread Hans Hagen
On 8/1/2016 12:47 PM, Mikael P. Sundqvist wrote: Wow! That was fast! I just updated and it indeed works as expected. I hate to ask another thing when I just got this fast and nice help, but is there also a way to change the control points in such a way that no _new_ sharp corners occur?

Re: [NTG-context] Randomize control points in metapost/metafun?

2016-08-01 Thread Mikael P. Sundqvist
On Mon, Aug 1, 2016 at 10:12 AM, Hans Hagen wrote: > On 8/1/2016 8:03 AM, Mikael P. Sundqvist wrote: >> >> Hi! >> >> I look for a way to randomize control points of a path, leaving the >> coordinates themselves untouched. >> >> The reason is the following: I want to draw (for

Re: [NTG-context] Randomize control points in metapost/metafun?

2016-08-01 Thread Hans Hagen
On 8/1/2016 8:03 AM, Mikael P. Sundqvist wrote: Hi! I look for a way to randomize control points of a path, leaving the coordinates themselves untouched. The reason is the following: I want to draw (for example) a circle with a triangle inside, and I want them to look slightly randomized. If I

[NTG-context] Randomize control points in metapost/metafun?

2016-08-01 Thread Mikael P. Sundqvist
Hi! I look for a way to randomize control points of a path, leaving the coordinates themselves untouched. The reason is the following: I want to draw (for example) a circle with a triangle inside, and I want them to look slightly randomized. If I do (see attached pdf for a typical result of

Re: [NTG-context] randomize

2010-04-08 Thread Wolfgang Werners-Lucchini
I know this and I have triggerd this by hand. So there is a lot of time between. I have purged files between every run and I got the same result if I wait 1 second, 1 minute or 1 day. Well, then it probably qualifies as a bug, and, since the .tuc file has apparently been dismissed as

Re: [NTG-context] randomize

2010-04-08 Thread Arthur Reutenauer
http://lua-users.org/lists/lua-l/2007-03/msg00564.html Interesting, thanks for the research. So now we know you use a Mac :-) Arthur ___ If your question is of interest to others as well, please add an

Re: [NTG-context] randomize

2010-04-08 Thread Wolfgang Schuster
Am 08.04.10 09:41, schrieb Arthur Reutenauer: http://lua-users.org/lists/lua-l/2007-03/msg00564.html Interesting, thanks for the research. So now we know you use a Mac :-) Sure? I think he use windows, take a look at the mail header: Pegasus Mail for Windows (4.41, DE v4.41 R1)

Re: [NTG-context] randomize

2010-04-08 Thread Arthur Reutenauer
Sure? I think he use windows, take a look at the mail header: Pegasus Mail for Windows (4.41, DE v4.41 R1) Right, I was misled by the thread on the Lua list he pointed to, that focused on the rand() implementation on Mac OS and other BSD descendants (I had overseen that it mentioned the same

Re: [NTG-context] randomize

2010-04-07 Thread Wolfgang Schuster
Am 07.04.10 01:10, schrieb Wolfgang Werners-Lucchini: Delete the tuc file with 'context --purgeall'. This does not work! I get allways the same. Delete \startluacode math.randomseed(os.time()) \stopluacode in your file. Wolfgang

Re: [NTG-context] randomize

2010-04-07 Thread Hans Hagen
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

Re: [NTG-context] randomize

2010-04-07 Thread luigi scarso
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

Re: [NTG-context] randomize

2010-04-07 Thread Wolfgang Werners-Lucchini
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',

Re: [NTG-context] randomize

2010-04-07 Thread Wolfgang Werners-Lucchini
Delete the tuc file with 'context --purgeall'. This does not work! I get allways the same. Delete \startluacode math.randomseed(os.time()) \stopluacode in your file. Now it works. But WHY? Wolfgang

Re: [NTG-context] randomize

2010-04-07 Thread Arthur Reutenauer
Now it works. But WHY? Because that's the way random number generators works. They're not random at all, they generate completely predictable number sequences from a seed: each time you use the same seed, you get the exact same sequence. In your case, you used os.time() as a seed, which is

Re: [NTG-context] randomize

2010-04-07 Thread Wolfgang Werners-Lucchini
Now it works. But WHY? Because that's the way random number generators works. They're not random at all, they generate completely predictable number sequences from a seed: each time you use the same seed, you get the exact same sequence. In your case, you used os.time() as a seed,

Re: [NTG-context] randomize

2010-04-07 Thread Arthur Reutenauer
I know this and I have triggerd this by hand. So there is a lot of time between. I have purged files between every run and I got the same result if I wait 1 second, 1 minute or 1 day. Well, then it probably qualifies as a bug, and, since the .tuc file has apparently been dismissed as a

Re: [NTG-context] randomize

2010-04-06 Thread Wolfgang Werners-Lucchini
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

Re: [NTG-context] randomize

2010-04-06 Thread Aditya Mahajan
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

[NTG-context] randomize

2010-04-05 Thread 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'}

Re: [NTG-context] randomize

2010-04-05 Thread Wolfgang Schuster
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

[NTG-context] randomize a color

2006-03-06 Thread Johan Sandblom
The following produces one red square and two black ones, as opposed to one red and two randomly perturbed but also red ones I was hoping for. To my poor understanding this usage seems to comply with that defined in mp-tool.mp. What am I doing wrong. Regards, Johan \setupcolors[state=start]

Re: [NTG-context] randomize a color

2006-03-06 Thread Taco Hoekwater
Johan Sandblom wrote: The following produces one red square and two black ones, as opposed to one red and two randomly perturbed but also red ones I was hoping for. To my poor understanding this usage seems to comply with that defined in mp-tool.mp. What am I doing wrong. hint: your redpart

Re: [NTG-context] randomize a color

2006-03-06 Thread Johan Sandblom
Well, being stupid isn't much fun, you know. One of the few consolations is bothering knowledgable people with questions that you are unable to figure out the (albeit obvious) answer to ... Thank you, Johan 2006/3/6, Taco Hoekwater [EMAIL PROTECTED]: Johan Sandblom wrote: The following