Converting python to JS - NumPy and and random.normal function

Hi @uqlleow, there was a similar discussion you can find here: Getting the median of an array in javascript

I must add, even though the code does get the median, there is a problem with the stimulus duration that is presented on the screen and the duration that I want (which is calculated as the median of the previous trials). Presented stimulus duration is much higher in some trials. This does not occur when I’m using average so there may be something about median calculation, I don’t know I’m still trying to fix it. But maybe you can get an idea from there.