Making Random Ratio task Random

27 views
Skip to first unread message

Laura Milton

unread,
Apr 4, 2022, 9:54:13 PM4/4/22
to FEDforum
Hi Lex, just wanted to catch you up on some of the modifications I’ve made to the Random Ratio (RR) task you made for Claire a little while ago. 

As she mentioned, each time we turned on the FED for a session of RR, the same sequence of pokes per pellet was required and this was true for all of different ratio schedules (1-5, 5-10 10-20 etc).

For example:
Within each of the three RR schedules, each session followed the exact same pattern/order of FR, so
- all RR5 sessions followed the pattern 1, 5, 1, 4, 3, 2, 2, 5, 2, 2, 4, 1, 4, 4, 1, 2, 5, 3, 3, 3, 3, 4, 1, 4, 5, 3, 5, etc etc
- all RR10 sessions followed the pattern 1, 10, 1, 9, 3, 7, 7, 10, 2, 2, 4, 6, 9, 4, 1, 7, 10, 3, 8, etc etc
- all RR20 sessions followed the pattern 1, 10, 1, 9, 13, 17, 17, 20, 12, 12, 4, 6, 9 etc etc

I noticed the relationship between all those series realizing that they are all pulling from the same one off generated random list (which makes sense as I looked into the random() function in Arduino and it does indeed generate a one off random list that is utilized with each successive execution of the sketch).

However, we wanted the order to be truly random and unique for each session on each FED, I have accomplished this by adding the following line of code as the first line in the void setup() function:

  randomSeed(analogRead(0));

It’s working perfectly now with every session generation from a unique random order.

Hope this is useful to others,

Cheers,

Laura Milton

Lex Kravitz

unread,
Apr 5, 2022, 5:30:17 PM4/5/22
to FEDforum
Thanks for the update Laura!  I'll update this program to include this randomization in the next library update!
Reply all
Reply to author
Forward
0 new messages