when you fall you cant dobble jump. When you jump, hit your head you can sometimes dobble jump/sometimes not. Seems half the times random, the other times it works?
The 'double jump' lets you jump once after you've left a surface. Your first jump never works in the air.
You can jump from the ground, or from holding a wall, and then use the double jump for a second jump in the air.
If you leave a surface by falling or running, or being bounced by a spring, your regular jump doesn't work, but the double jump ability still lets you make one jump while airborne.
So if you want to jump as far as possible, you want to start with a jump, because the initial jump only works when you're on a surface. After that you can do your dash and 'double jump' in the air.
It's never random, and always works like this.