1. A method of storing information in a memory, comprising: computing, for each synapse of a plurality of synapses in a neural network, an update of a weight of that synapse according to a learning rule; and switching, in probabilistic manner for each of the synapses, a binary state of a location within the memory associated with that synapse based on the update of the weight, wherein switching the binary state in the probabilistic manner comprises: based on the update of the weight, generating, with a probability of switching, a pulse or an electrical current, the pulse and the electrical current not being part of neuron spiking in the neural network, and switching the binary state of the location within the memory using the pulse or the electrical current.