The theory of Probability and Statistics supplies very powerful tools when we aim to retrieve information from a set of observed data. Indeed, having at disposal datasets about real and relevant questions such as, for example, the labor market of a State or the amount of traffic through an Internet connection, we often need to manage large amounts of data to obtain a concise description of the dynamics they are related to. In this work we treat two specific problems: the analysis of the firm size dynamics of a sample from the industrial district of Prato (Italy), and the proposal of a randomized algorithm for searching a specific element among the words of a linear code. We obtain interesting results using, in both the cases, Markov chains and urn models. In particular urn models, idealized schemes in which the units in the sample under study are considered as balls moving among different urns, provide an unifying view. Indeed we will show that the two aforementioned problems can be described by the same urn model. Other results regard the expected behavior of firms towards upsizing or downsizing, and an overview about the efficiency of the proposed algorithm.