so apparently the golden cookies give you upgrades like x2 cookie production for 60 seconds
And it also adds cookies. I think the value you get is 1 digit less than the cookies you have and then it's a random number
So if I have 10,000,000 cookies I can get 3,267,245 or 8,345,622 (or anything between 1,000,000 and 9,999,999). At least looked like it. Applies to any number of digits by the way.