//先随机产生一个下标再获取元素String random = "";String[] doc = {"成功领取赠险", "安全到家", "已领取50万保障", "和家人团聚","在家中贴春联"};int index = (int) (Math.random() * doc.length);random = doc[index];