Calling pgf rand inside pgfmathsetmacro creates extra text

by iluvatar   Last Updated January 14, 2018 04:23 AM

I am using pgf and tikz for some latex questions. The code below illustrates a problem I am facing: when I use the rand function from pgf inside a pgfmathsetmacro I get some extra text at the beginning of the example text (in my case, I get Y1Y1). If I remove the call to rand then I do not get that extra text, but or course I do not get random values. I have read the docs but haven't found yet a clue. What I am doing wrong? Thanks in advance.



%\pgfmathsetmacro{\QA}{9.0*(1 + \FACTOR*3)}
\pgfmathsetmacro{\QA}{9.0*(1 + \FACTOR*rand} % generates spurious Y1Y1 or similar text
TEST-TEXT \pgfmathparse{3*\QA}\pgfmathprintnumber{\pgfmathresult}

Related Questions

Pair of Random Numbers without Common Factors

Updated July 22, 2017 15:23 PM

How to Create Random Letter?

Updated July 22, 2017 23:23 PM

Gaussian random numbers

Updated July 14, 2017 12:23 PM

Why Are My Random List Items Always Identical?

Updated September 26, 2017 00:23 AM

Random Permutations of List Items

Updated August 25, 2017 22:23 PM