In this paper we consider the consensus problem for stochastic switched linear dynamical systems. For discrete-time and continuous-time stochastic switched linear systems, we present necessary and sufficient conditions under which such systems reach a consensus almost surely. In the discrete-time case, our assumption is that the underlying graph of the system at any given time instance is derived from a random graph process, independent of other time instances. These graphs can be weighted, directed and with dependent edges. For the continuous-time case, we assume that the switching is governed by a Poisson point process and the graphs characterizing the topology of the system are independent and identically distributed over time. For both such frameworks, we present necessary and sufficient conditions for almost sure asymptotic consensus using simple ergodicity and probabilistic arguments. These easily verifiable conditions depend on the spectrum of the average weight matrix and the average Laplacian matrix for the discrete-time and continuous-time cases, respectively.