Optimization of beam line parameters for space charge dominated multi-species beam using random search method