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

Schmitz Thomas A. thomas.schmitz at uni-bonn.de
Wed Feb 19 12:11:24 CET 2014


On 19 Feb 2014, at 11:37, Alan BRASLAU <alan.braslau at cea.fr> 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 saying
> 	withcolor transparent (1,0.3,mycolor[round(uniformdeviate(10*i)/10)])
> or you can define a RandomColor as below:

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 surprised that every run produces the same random order. RandomColor is nice, but not for my current purpose because I want to choose from a fixed list (colors are used as backgrounds, so I can only use dark colours, e.g.).

Thanks a lot!

Thomas


More information about the ntg-context mailing list