Millisecond Forums

Random function returns different results in 3.0.6 versus 3.0.4

https://forums.millisecond.com/Topic7282.aspx

By robgommans - 1/24/2012

Hi,


Does somebody know why the following line of code returns a different, incorrect number in version 3.0.6, while returning a correct number in version 3.0.4?


rand(30,40)


In v3.0.4., it returns a number between 30 and 40. In v3.0.6, it returns -43545435353455 of something like that. In other words, an incorrect number. Should I initialize something first in v3.0.6, before using the random function?


Thanks,
Rob 

By Dave - 1/25/2012

E.g.


<expressions>
/ myexpression = rand(30,40)
</expressions>

<text mytext>
/ items = ("<%expressions.myexpression%>")
</text>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (anyresponse)
</trial>

<block myblock>
/ trials = [1-4=mytrial]
</block>


works perfectly fine for me under 3.0.6.0. You should check whether you're running the very latest build (Dec 19) and/or provide proper context re. your particular use case.


Regards,


~Dave

By robgommans - 1/25/2012

Hi Dave,


Thanks for your reply. 


It must have been the build of v3.0.6. I tested my code on a different computer and the problem occurred. Since v3.0.6 was installed on this computer (rather than 3.0.4), I installed v3.0.4. and tested the code again. Now, the problem didn't occur. That is why I first thought it had something to do with the new version. I downloaded v3.0.6. again, re-installed it, and now it works fine. Unfortunately, I don't know the build of the previous v3.0.6 installed on this computer.


Best,
Rob