Re: [NTG-context] mp: choose colors randomly from list

2014-02-19 Thread Alan BRASLAU
On Wed, 19 Feb 2014 12:38:38 +0100 Schmitz Thomas A. wrote: > Not only I’m bad at math, I don’t even remember the answers to my own > questions - thanks Wolfgang for reminding me! I’m getting old and > senile, should look into early retirement... The random numbers generated are deterministic, t

Re: [NTG-context] mp: choose colors randomly from list

2014-02-19 Thread Schmitz Thomas A.
On 19 Feb 2014, at 12:16, Wolfgang Schuster wrote: > http://www.ntg.nl/pipermail/ntg-context/2012/065815.html > > Wolfgang Not only I’m bad at math, I don’t even remember the answers to my own questions - thanks Wolfgang for reminding me! I’m getting old and senile, should look into early re

Re: [NTG-context] mp: choose colors randomly from list

2014-02-19 Thread Wolfgang Schuster
Am 19.02.2014 um 12:11 schrieb Schmitz Thomas A. : > I hate myself for not knowing more about math! I don’t see how mp picks its > random numbers - when I recompile, I always get the same colors in the same > order. They are “random” in the sense that there is no fixed order, but I was > surpr

Re: [NTG-context] mp: choose colors randomly from list

2014-02-19 Thread Schmitz Thomas A.
On 19 Feb 2014, at 11:37, Alan BRASLAU wrote: > uniformdeviate returns a random number between zero and the value of > the argument. So you do not want (uniformdeviate i). Ah, that explains it. Thanks a lot Alan! Otared Kavian wrote: > One way is to increase the « degree of randomness » by sa

Re: [NTG-context] mp: choose colors randomly from list

2014-02-19 Thread Otared Kavian
Hi Thomas, One way is to increase the « degree of randomness » by saying withcolor transparent (1,0.3,mycolor[round(uniformdeviate(10*i)/10)]) or you can define a RandomColor as below: \startuniqueMPgraphic{colortest} save mycolor ; color mycolor[] ; mycolor[1] := (0.07, 0.21, 0.65) ; myc

Re: [NTG-context] mp: choose colors randomly from list

2014-02-19 Thread Alan BRASLAU
mycolor[1 + round (uniformdeviate 2)] (or define mycolor[0]-mycolor[2], in which case you can drop the "1 +") uniformdeviate returns a random number between zero and the value of the argument. So you do not want (uniformdeviate i). Alan On Wed, 19 Feb 2014 11:10:57 +0100 Schmitz Thomas A. wro

[NTG-context] mp: choose colors randomly from list

2014-02-19 Thread Schmitz Thomas A.
Hi all, I would like to have mp choose a (transparent) color randomly from a predefined list. My naive approach was (let’s restrict it to three colors): \startuniqueMPgraphic{colortest} save mycolor ; color mycolor[] ; mycolor[1] := (0.07, 0.21, 0.65) ; mycolor[2] := (0.6, 0.6, 0.4) ; mycolor[3]