Theory and experimental verification of configurable computing with stochastic memristors