URL of experiment: https://run.pavlovia.org/vickup/brm_calc_valence_2/html
Is this:
A problem with my code
Just how browsers typically generate random numbers and theres nothing I can do about it
A problem with how psychoJS implements an experiment to someone.
Description of the problem:
We generate a random number to select 1 of 40 lists to show the participants.
rand_list_num = Math.floor((Math.random() * max_list_num) + 1);
The random number generator is working however when we run this experiment 200 times the standard deviation of the numbers generated is 2.5. Indicating that there are a lot of random numbers that are chosen more frequently than others.
Is there any way to get the distribution of numbers chosen to be more equal?
A solution that I though of would just be to create an array from 1-40 items and just shuffle the array and return the first element, but I figured I’d run into the same problem.
I’m also aware that I set the seed value in my trialHandler in the next line but I don’t believe that is the issue because it follows the Math.random() command.
Thanks for any input.
My code:
//read in stimuli
valence_semantic_lists = new TrialHandler({
psychoJS: psychoJS,
trialList: 'valence_semantic_lists.csv',
nReps: 1,
method: TrialHandler.Method.SEQUENTIAL,
extraInfo: expInfo,
seed: 2,
name: 'valence_semantic_lists'
});```