changed astrostats.weightedrand such that it returns just an index of an array