Extract random cells to function