To implement the function fo ran_sack gem.