update to use ids[rand(ids.length)]