Two things follow this mechanism: the Golden cookie (Wrath Cookie) and Reindeer. They are called shimmers in the game. The spawning mechanism is probabilistic, however the probability density function can be approximated by a simple function. This mechanism is also affected by your current FPS (frames per second), which can be changed via cheating. From now on we shall assume the FPS is 30.
Let us first ignore the initial Tmin seconds during which the probability of spawning Golden Cookie is 0.
There are two basic parameter for shimmers; Tmin and Tmax, and there are many factors in the game can alter these two parameters[note 1]. For first Tmin seconds, the probability of spawn shimmers is 0. After Tmin seconds every frame, the game checks if a random number between 0 and 1 is less than the proportion of time elapsed and the difference between the maximum and minimum time, taken to the 5th power. Define the test probability at frame n:
Where N=30(Tmax-Tmin) frames is the difference of max time and min time in frame. The probability of spawning the shimmer at frame n is:
This means the game failed to spawn from frame 1 to frame n-1, but successes at frame n. To calculate cumulative density function, which means probability of spawing before frame n, we must sum over pn:
When n=N, we have fN=1 and PN=1 which means the shimmer is guaranteed to be spawned before frame N. So far everything is exact, and n is a discrete integer. We shall approximate n as a continuous real number. Notice that:
Since the time of each frame is short compared to the maximum time, we may approximate the difference of left hand side as a derivative:
This differential equation can be solved normally. The cumulative density function of the cookie spawning at kth frame is:
We can change the time unit to more familiar second. Let k=30t and N=30T, and we have:
The resulting cumulative probability of the cookie spawning looks logistic, with the probability early in the range nearly zero but increasing extremely quickly. This function fits well, but fails when t=T=Tmax-Tmin:
However, it should not be an issue in most cases, since T is usually larger than 10 in the game and P(T) is extremely close to 1.
So far we have ignored first non-spawning Tmin seconds, which means p(t) actually represent the probability of spawning at t+Tmin seconds, not t seconds. Let us define a new probability function p(t), which represents the probability of spawning at t seconds.
Similarly, we can define a new cumulative probability function P(t), which represents the probability of spawning before t seconds.
It is also convenient to consider the inverse function of P(t):
The expectation value of spawning time can be obtained:
Where Γ is the gamma function.
- You may use the command "Game.shimmerTypes[type].minTime" and "Game.shimmerTypes[type].maxTime" in the console to check the actual value in the game. type can be golden or reindeer and the unit is frame.