It's stressful to write code during an interview but it's necessary since it really helps understanding how the developer thinks when he's trying to solve a problem.
I usually ask candidates to write code on paper, or even speak the code they want to write. If they know the algorithm but not the function names I don't care. This test is done after the first part of the interview where the candidate is given multiple questions so, usually, I already know if the candidate is good or not ;)