How to render algorithm2e

\begin{document}
\begin{algorithm}
\caption{Initialisation}
\FnOn{\textsf{\upshape initialisation}}
{\textsf{\upshape \(currentTerm\) := 0; \(votedFor\) := null}\;
\textsf{\upshape\(log := \langle\rangle; commitLength\) := 0}\;
\textsf{\upshape\(currentRole\) := follower; \(curentLeader\) := null}\;
\(votesReceived := {}; sentLength := \langle\rangle; ackedLength := \langle\rangle\)}

\FnOn{\textsf{\upshape recovery from crash}}
{\textsf{\upshape \(currentRole\) := follower}\;
\textsf{\upshape \(currentLeader\) := null}\;
\(votedReceived := {}; sentLength := \langle\rangle; ackedLength := \langle\rangle\)}

\FnOn{\textsf{\upshape node \(nodeId\) suspects leader has failed, or on election timeout}}
{\textsf{\upshape \(currentTerm := currentTerm + 1; currentRole\) := candidate}\;
\textsf{\upshape \(votedFor := nodeId; votesReceived := { nodeId } ; lastTerm := 0\)}\;
\If{\textsf{\upshape \(log\).length > 0}}{\textsf{\upshape \(lastTerm\) := \(log[log\).length − 1\(]\).term;}}
\textsf{\upshape \(msg\) := (VoteRequest, \(nodeId\), \(currentTerm\), \(log\).length, \(lastTerm\))}\;
\For{\textsf{\upshape each \(node \in nodes\)}}{\KwSend \textsf{\upshape \(msg\) to \(node\)}}
\textsf{\upshape start election timer}}
\end{algorithm}
\end{document}