Hello Natasha,
I am including a sample code below that should give you a basic guide on how to do a random ratio schedule.
Below you will see I have made a list Z. I have included 5 elements in Z to show the .2 probability you mentioned.
I am using the variable A to represent the number picked randomly from List Z.
Med PC uses two different functions for random operations, RANDD and RANDI. The difference between the two is that RANDD does not use replacement, but will randomly pick a number from a list and then that number won’t be picked again until every number on the list has been picked.
RANDI will randomly pick a number from the list and then put it back into the list where it can be chosen again.
The sample code below begins with a #START command, then moving into S2 where 1 second passes and then the RANDI function makes the variable A equal to a number randomly picked from Z. We then move to S3 where the code waits for a certain number of left lever presses dictated by whatever number A is.
After that many presses, a Z1 pulse is created. In this, I made Z1 be what would distribute the reward. In State Set 2, I added a line that waits for the reward to be given before updating a show field that displays how many times a reward has been given.
^LeftLever = 1
\ A = Ratio Value Drawn from List Z
\ Z() = Variable Ratio Array
\ Z Pulse
\ Z1 = Reward Output
LIST Z = 1, 2, 3, 4, 5
S.S.1
S1,
#START: —> S2
S2,
1″: RANDI A = Z —> S3
S3,
A#R^LeftLever: Z1 —> S2
S.S.2
S1,
#Z1: ADD X; SHOW 1, Rewards Issued, X —> S1
You can also find a more in depth explanation of how RANDD and RANDI work in the MED-PC Programmer’s Manual found in the Manuals section of our website. The manual also includes a step by step tutorial that would help you familiarize yourself with some of the more common functions of Med State Notation.