package com.rf.psychological.utils;

import cn.hutool.core.util.RandomUtil;

import java.util.Arrays;
import java.util.List;

/**
 * @Description:随机获取总分说明工具类
 * @Author: mimang
 * @Date: 2024/5/7
 */
public class RandomSuggestionUtil {

    public static String getSuggestion(String suggestion){
        List<String> list = Arrays.asList(suggestion.split("#;"));
        if (list.size()>1){
            int size = list.size();
            int num = RandomUtil.randomInt(0,size-1);
            String text = list.get(num).substring(list.get(num).indexOf(".")+1);
            return text.contains("#")?text.replace("#",""):text;
        }else {
            return suggestion;
        }
    }
}
