Fix errors in totem.nn.checkTypeCastable with stochastic output

The random number generator is returned to the original state before
running the module in the cast state.
Merge pull request #20 from akfidjeland/stochastic

Fix errors in totem.nn.checkTypeCastable with stochastic output