4. If the equation $\cos 2 x+\sqrt{3} \sin 2 x=a+1$ has two different real solutions $x$ in $\left[0, \frac{\pi}{2}\right]$, then the range of the parameter $a$ is
A. $0 \leqslant a<1$
B. $-3 \leqslant a<1$
C. $a<1$
D. $0<a<1$
4. $\mathrm{A}$