you can add that code to the place where you increase unicornPoints, that way the code only runs when the point gets added.
the other option is to use another variable as a flag. When you increase unicornPoints, set the flag to 1.
then change your code to say:
System flag = 1 -> then set candyRandomizer to random(4), and flag = 0
then the code wont run again until flag is 1 again.