Random duration record different from excel

OS : Win10
PsychoPy version:2023.2.3
Standard Standalone? (y/n) :y
**What are you trying to achieve?:**I’d like to set pattern mask duration in 500-1000ms, I used jitter code to set this time
dur1 = randint(500,1000)/1000
thisExp.addData(“duration1”,dur1)
but when I check the duration record in Excel, I found that 【pattern mask stopped-pattern mask started】 doesn’t equal to duration, it doesn’t even fall in 500-1000ms, what’s the reason, is there anything to do with refresh rate?

looking forward to your help~

[quote=“WuYuting, post:2, topic:39512, full:true”]
Question here has a lot to do with discussion from Jittering results in output file

There are a couple of guesses at the moment as to what it might be due to:

  1. the jitter component is not placed at the top, but after it is placed at the very beginning of the routine, pattern mask still doesn’t last the amount of time set by dur1
  2. the termination $ is currently defined with “duration time”, maybe this should be replaced with “time”. i’m not quite sure what the difference is between this two, for example I would expect this routine to have the duration of dur1, what is the difference between [duration time]$dur1 and [time]$dur1 +(time used in previous routine).

I always put code components at the top of my routines unless I have a specific reason to do otherwise it

You could try saving the value for t in End Routine to see how that compares with dur1. I’d expect it to be about 16ms longer.