The study of event-by-event fluctuations of net-baryon number in a subspace of full phase space is a promising direction for deciphering the structure of strongly interacting matter created in collisions of relativistic heavy nuclei. Such fluctuations are generally suppressed by exact baryon number conservation. Moreover, the suppression is stronger if baryon number is conserved locally. In this report we present a conceptually new approach to quantify correlations in rapidity space between baryon-antibaryon, baryon-baryon, and antibaryon-antibaryon pairs and demonstrate their impact on net-baryon number fluctuations. For the special case of Gaussian rapidity distributions, we use the Cholesky factorization of the covariance matrix, while the general case is introduced by exploiting the well-known Metropolis and Simulated Annealing methods. The approach is based on the use of the canonical ensemble of statistical mechanics for baryon number and can be applied to study correlations between baryons as well as strange and/or charm hadrons. It can also be applied to describe relativistic nuclear collisions leading to the production of multi-particle final states. One application of our method is the search for formation of proton clusters at low collision energies emerging as a harbinger of the anticipated first-order chiral phase transition. In a first step, the results obtained are compared to the recent measurements from the CERN ALICE collaboration. Such investigations are key to explore the phase diagram of strongly interacting matter and baryon production mechanisms at energy scales from several GeV to several TeV.