简单随机数据算法

news2024/11/26 6:52:48

文章目录

  • 一,需求概述
  • 二,实现代码
  • 三、测试代码
  • 四、测试结果
  • 五、源码传送
  • 六、效果演示

一,需求概述

系统启动时,读取一组图片数据,通过接口返回给前台,要求:

  • 图片随机
  • 相邻图片不重复

二,实现代码

借助Queue实现FIFO

/**
 * 随机索引<br>
 */
@Slf4j
public class RandomIndex
{
    int length;
    
    byte[] lock = new byte[0];
    
    Queue<Integer> quque = new ConcurrentLinkedQueue<>();
    
    /**
     * 实例化
     * 
     * @param length 总数据长度
     */
    public RandomIndex(int length)
    {
        super();
        this.length = length;
    }
    
    /**
     * 返回与最近数据不重复的随机索引值
     * 
     * @return
     */
    public int getIndex()
    {
        // 集中1次生成不超过20条数据,多次使用
        int ququeMaxSize = Math.min(length, 20);
        if (quque.size() < 3 || quque.size() < ququeMaxSize / 2)
        {
            synchronized (lock)
            {
                int add;
                while (quque.size() < ququeMaxSize)
                {
                    add = RandomUtils.nextInt(0, length);
                    if (!quque.contains(add))
                    {
                        quque.add(add);
                    }
                }
            }
            log.info("{}", quque);
        }
        int index = quque.poll();
        log.info("{} <= {}", index, quque);
        return index;
    }
}

三、测试代码

@Slf4j
public class RandomIndexTest
{
    @Test
    public void test()
    {
        try (Scanner sc = new Scanner(System.in))
        {
            do
            {
                // 索引最大值[2,40),连续获取次数[20,100)
                int size = RandomUtils.nextInt(2, 40);
                int count = RandomUtils.nextInt(20, 100);
                log.info("###### size: {}, count: {}", size, count);
                RandomIndex randomIndex = new RandomIndex(size);
                IntStream.range(0, count).forEach(i -> randomIndex.getIndex());
                
                log.info("------------输入x退出,回车换行继续------------");
            } while (!"x".equalsIgnoreCase(sc.nextLine()));
            log.info("------------成功退出------------");
        }
    }
}

四、测试结果


2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.s.RandomIndexTest        : ###### size: 37, count: 43
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : [2, 6, 35, 11, 14, 28, 17, 12, 13, 21, 33, 36, 24, 30, 31, 25, 18, 0, 26, 32]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 2 <= [6, 35, 11, 14, 28, 17, 12, 13, 21, 33, 36, 24, 30, 31, 25, 18, 0, 26, 32]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 6 <= [35, 11, 14, 28, 17, 12, 13, 21, 33, 36, 24, 30, 31, 25, 18, 0, 26, 32]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 35 <= [11, 14, 28, 17, 12, 13, 21, 33, 36, 24, 30, 31, 25, 18, 0, 26, 32]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 11 <= [14, 28, 17, 12, 13, 21, 33, 36, 24, 30, 31, 25, 18, 0, 26, 32]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 14 <= [28, 17, 12, 13, 21, 33, 36, 24, 30, 31, 25, 18, 0, 26, 32]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 28 <= [17, 12, 13, 21, 33, 36, 24, 30, 31, 25, 18, 0, 26, 32]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 17 <= [12, 13, 21, 33, 36, 24, 30, 31, 25, 18, 0, 26, 32]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 12 <= [13, 21, 33, 36, 24, 30, 31, 25, 18, 0, 26, 32]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 13 <= [21, 33, 36, 24, 30, 31, 25, 18, 0, 26, 32]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 21 <= [33, 36, 24, 30, 31, 25, 18, 0, 26, 32]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 33 <= [36, 24, 30, 31, 25, 18, 0, 26, 32]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : [36, 24, 30, 31, 25, 18, 0, 26, 32, 17, 14, 2, 1, 34, 10, 4, 22, 6, 3, 8]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 36 <= [24, 30, 31, 25, 18, 0, 26, 32, 17, 14, 2, 1, 34, 10, 4, 22, 6, 3, 8]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 24 <= [30, 31, 25, 18, 0, 26, 32, 17, 14, 2, 1, 34, 10, 4, 22, 6, 3, 8]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 30 <= [31, 25, 18, 0, 26, 32, 17, 14, 2, 1, 34, 10, 4, 22, 6, 3, 8]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 31 <= [25, 18, 0, 26, 32, 17, 14, 2, 1, 34, 10, 4, 22, 6, 3, 8]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 25 <= [18, 0, 26, 32, 17, 14, 2, 1, 34, 10, 4, 22, 6, 3, 8]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 18 <= [0, 26, 32, 17, 14, 2, 1, 34, 10, 4, 22, 6, 3, 8]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 0 <= [26, 32, 17, 14, 2, 1, 34, 10, 4, 22, 6, 3, 8]
2024-05-28 22:41:03.107  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 26 <= [32, 17, 14, 2, 1, 34, 10, 4, 22, 6, 3, 8]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 32 <= [17, 14, 2, 1, 34, 10, 4, 22, 6, 3, 8]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 17 <= [14, 2, 1, 34, 10, 4, 22, 6, 3, 8]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 14 <= [2, 1, 34, 10, 4, 22, 6, 3, 8]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : [2, 1, 34, 10, 4, 22, 6, 3, 8, 20, 18, 16, 29, 35, 30, 27, 25, 23, 21, 33]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 2 <= [1, 34, 10, 4, 22, 6, 3, 8, 20, 18, 16, 29, 35, 30, 27, 25, 23, 21, 33]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 1 <= [34, 10, 4, 22, 6, 3, 8, 20, 18, 16, 29, 35, 30, 27, 25, 23, 21, 33]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 34 <= [10, 4, 22, 6, 3, 8, 20, 18, 16, 29, 35, 30, 27, 25, 23, 21, 33]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 10 <= [4, 22, 6, 3, 8, 20, 18, 16, 29, 35, 30, 27, 25, 23, 21, 33]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 4 <= [22, 6, 3, 8, 20, 18, 16, 29, 35, 30, 27, 25, 23, 21, 33]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 22 <= [6, 3, 8, 20, 18, 16, 29, 35, 30, 27, 25, 23, 21, 33]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 6 <= [3, 8, 20, 18, 16, 29, 35, 30, 27, 25, 23, 21, 33]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 3 <= [8, 20, 18, 16, 29, 35, 30, 27, 25, 23, 21, 33]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 8 <= [20, 18, 16, 29, 35, 30, 27, 25, 23, 21, 33]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 20 <= [18, 16, 29, 35, 30, 27, 25, 23, 21, 33]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 18 <= [16, 29, 35, 30, 27, 25, 23, 21, 33]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : [16, 29, 35, 30, 27, 25, 23, 21, 33, 15, 1, 17, 9, 22, 12, 14, 20, 18, 24, 0]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 16 <= [29, 35, 30, 27, 25, 23, 21, 33, 15, 1, 17, 9, 22, 12, 14, 20, 18, 24, 0]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 29 <= [35, 30, 27, 25, 23, 21, 33, 15, 1, 17, 9, 22, 12, 14, 20, 18, 24, 0]
2024-05-28 22:41:03.108  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 35 <= [30, 27, 25, 23, 21, 33, 15, 1, 17, 9, 22, 12, 14, 20, 18, 24, 0]
2024-05-28 22:41:03.109  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 30 <= [27, 25, 23, 21, 33, 15, 1, 17, 9, 22, 12, 14, 20, 18, 24, 0]
2024-05-28 22:41:03.109  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 27 <= [25, 23, 21, 33, 15, 1, 17, 9, 22, 12, 14, 20, 18, 24, 0]
2024-05-28 22:41:03.109  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 25 <= [23, 21, 33, 15, 1, 17, 9, 22, 12, 14, 20, 18, 24, 0]
2024-05-28 22:41:03.109  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 23 <= [21, 33, 15, 1, 17, 9, 22, 12, 14, 20, 18, 24, 0]
2024-05-28 22:41:03.109  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 21 <= [33, 15, 1, 17, 9, 22, 12, 14, 20, 18, 24, 0]
2024-05-28 22:41:03.109  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 33 <= [15, 1, 17, 9, 22, 12, 14, 20, 18, 24, 0]
2024-05-28 22:41:03.109  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 15 <= [1, 17, 9, 22, 12, 14, 20, 18, 24, 0]
2024-05-28 22:41:03.109  INFO 4788 --- [main] c.f.h.s.RandomIndexTest        : ------------输入x退出,回车换行继续------------

2024-05-28 22:41:04.146  INFO 4788 --- [main] c.f.h.s.RandomIndexTest        : ###### size: 20, count: 65
2024-05-28 22:41:04.146  INFO 4788 --- [main] c.f.h.c.RandomIndex            : [12, 2, 17, 14, 16, 3, 18, 19, 9, 13, 10, 11, 6, 1, 5, 4, 8, 15, 7, 0]
2024-05-28 22:41:04.146  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 12 <= [2, 17, 14, 16, 3, 18, 19, 9, 13, 10, 11, 6, 1, 5, 4, 8, 15, 7, 0]
2024-05-28 22:41:04.146  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 2 <= [17, 14, 16, 3, 18, 19, 9, 13, 10, 11, 6, 1, 5, 4, 8, 15, 7, 0]
2024-05-28 22:41:04.146  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 17 <= [14, 16, 3, 18, 19, 9, 13, 10, 11, 6, 1, 5, 4, 8, 15, 7, 0]
2024-05-28 22:41:04.146  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 14 <= [16, 3, 18, 19, 9, 13, 10, 11, 6, 1, 5, 4, 8, 15, 7, 0]
2024-05-28 22:41:04.146  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 16 <= [3, 18, 19, 9, 13, 10, 11, 6, 1, 5, 4, 8, 15, 7, 0]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 3 <= [18, 19, 9, 13, 10, 11, 6, 1, 5, 4, 8, 15, 7, 0]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 18 <= [19, 9, 13, 10, 11, 6, 1, 5, 4, 8, 15, 7, 0]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 19 <= [9, 13, 10, 11, 6, 1, 5, 4, 8, 15, 7, 0]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 9 <= [13, 10, 11, 6, 1, 5, 4, 8, 15, 7, 0]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 13 <= [10, 11, 6, 1, 5, 4, 8, 15, 7, 0]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 10 <= [11, 6, 1, 5, 4, 8, 15, 7, 0]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : [11, 6, 1, 5, 4, 8, 15, 7, 0, 13, 2, 18, 17, 14, 19, 9, 16, 3, 10, 12]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 11 <= [6, 1, 5, 4, 8, 15, 7, 0, 13, 2, 18, 17, 14, 19, 9, 16, 3, 10, 12]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 6 <= [1, 5, 4, 8, 15, 7, 0, 13, 2, 18, 17, 14, 19, 9, 16, 3, 10, 12]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 1 <= [5, 4, 8, 15, 7, 0, 13, 2, 18, 17, 14, 19, 9, 16, 3, 10, 12]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 5 <= [4, 8, 15, 7, 0, 13, 2, 18, 17, 14, 19, 9, 16, 3, 10, 12]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 4 <= [8, 15, 7, 0, 13, 2, 18, 17, 14, 19, 9, 16, 3, 10, 12]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 8 <= [15, 7, 0, 13, 2, 18, 17, 14, 19, 9, 16, 3, 10, 12]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 15 <= [7, 0, 13, 2, 18, 17, 14, 19, 9, 16, 3, 10, 12]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 7 <= [0, 13, 2, 18, 17, 14, 19, 9, 16, 3, 10, 12]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 0 <= [13, 2, 18, 17, 14, 19, 9, 16, 3, 10, 12]
2024-05-28 22:41:04.147  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 13 <= [2, 18, 17, 14, 19, 9, 16, 3, 10, 12]
2024-05-28 22:41:04.148  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 2 <= [18, 17, 14, 19, 9, 16, 3, 10, 12]
2024-05-28 22:41:04.148  INFO 4788 --- [main] c.f.h.c.RandomIndex            : [18, 17, 14, 19, 9, 16, 3, 10, 12, 4, 8, 11, 13, 0, 6, 7, 2, 5, 15, 1]
2024-05-28 22:41:04.148  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 18 <= [17, 14, 19, 9, 16, 3, 10, 12, 4, 8, 11, 13, 0, 6, 7, 2, 5, 15, 1]
2024-05-28 22:41:04.148  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 17 <= [14, 19, 9, 16, 3, 10, 12, 4, 8, 11, 13, 0, 6, 7, 2, 5, 15, 1]
2024-05-28 22:41:04.148  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 14 <= [19, 9, 16, 3, 10, 12, 4, 8, 11, 13, 0, 6, 7, 2, 5, 15, 1]
2024-05-28 22:41:04.148  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 19 <= [9, 16, 3, 10, 12, 4, 8, 11, 13, 0, 6, 7, 2, 5, 15, 1]
2024-05-28 22:41:04.148  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 9 <= [16, 3, 10, 12, 4, 8, 11, 13, 0, 6, 7, 2, 5, 15, 1]
2024-05-28 22:41:04.148  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 16 <= [3, 10, 12, 4, 8, 11, 13, 0, 6, 7, 2, 5, 15, 1]
2024-05-28 22:41:04.148  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 3 <= [10, 12, 4, 8, 11, 13, 0, 6, 7, 2, 5, 15, 1]
2024-05-28 22:41:04.148  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 10 <= [12, 4, 8, 11, 13, 0, 6, 7, 2, 5, 15, 1]
2024-05-28 22:41:04.148  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 12 <= [4, 8, 11, 13, 0, 6, 7, 2, 5, 15, 1]
2024-05-28 22:41:04.148  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 4 <= [8, 11, 13, 0, 6, 7, 2, 5, 15, 1]
2024-05-28 22:41:04.148  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 8 <= [11, 13, 0, 6, 7, 2, 5, 15, 1]
2024-05-28 22:41:04.148  INFO 4788 --- [main] c.f.h.c.RandomIndex            : [11, 13, 0, 6, 7, 2, 5, 15, 1, 10, 4, 14, 17, 18, 12, 8, 16, 3, 9, 19]
2024-05-28 22:41:04.149  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 11 <= [13, 0, 6, 7, 2, 5, 15, 1, 10, 4, 14, 17, 18, 12, 8, 16, 3, 9, 19]
2024-05-28 22:41:04.149  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 13 <= [0, 6, 7, 2, 5, 15, 1, 10, 4, 14, 17, 18, 12, 8, 16, 3, 9, 19]
2024-05-28 22:41:04.149  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 0 <= [6, 7, 2, 5, 15, 1, 10, 4, 14, 17, 18, 12, 8, 16, 3, 9, 19]
2024-05-28 22:41:04.149  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 6 <= [7, 2, 5, 15, 1, 10, 4, 14, 17, 18, 12, 8, 16, 3, 9, 19]
2024-05-28 22:41:04.149  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 7 <= [2, 5, 15, 1, 10, 4, 14, 17, 18, 12, 8, 16, 3, 9, 19]
2024-05-28 22:41:04.149  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 2 <= [5, 15, 1, 10, 4, 14, 17, 18, 12, 8, 16, 3, 9, 19]
2024-05-28 22:41:04.149  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 5 <= [15, 1, 10, 4, 14, 17, 18, 12, 8, 16, 3, 9, 19]
2024-05-28 22:41:04.149  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 15 <= [1, 10, 4, 14, 17, 18, 12, 8, 16, 3, 9, 19]
2024-05-28 22:41:04.149  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 1 <= [10, 4, 14, 17, 18, 12, 8, 16, 3, 9, 19]
2024-05-28 22:41:04.149  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 10 <= [4, 14, 17, 18, 12, 8, 16, 3, 9, 19]
2024-05-28 22:41:04.149  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 4 <= [14, 17, 18, 12, 8, 16, 3, 9, 19]
2024-05-28 22:41:04.149  INFO 4788 --- [main] c.f.h.c.RandomIndex            : [14, 17, 18, 12, 8, 16, 3, 9, 19, 2, 0, 7, 4, 10, 13, 6, 1, 5, 11, 15]
2024-05-28 22:41:04.149  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 14 <= [17, 18, 12, 8, 16, 3, 9, 19, 2, 0, 7, 4, 10, 13, 6, 1, 5, 11, 15]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 17 <= [18, 12, 8, 16, 3, 9, 19, 2, 0, 7, 4, 10, 13, 6, 1, 5, 11, 15]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 18 <= [12, 8, 16, 3, 9, 19, 2, 0, 7, 4, 10, 13, 6, 1, 5, 11, 15]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 12 <= [8, 16, 3, 9, 19, 2, 0, 7, 4, 10, 13, 6, 1, 5, 11, 15]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 8 <= [16, 3, 9, 19, 2, 0, 7, 4, 10, 13, 6, 1, 5, 11, 15]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 16 <= [3, 9, 19, 2, 0, 7, 4, 10, 13, 6, 1, 5, 11, 15]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 3 <= [9, 19, 2, 0, 7, 4, 10, 13, 6, 1, 5, 11, 15]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 9 <= [19, 2, 0, 7, 4, 10, 13, 6, 1, 5, 11, 15]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 19 <= [2, 0, 7, 4, 10, 13, 6, 1, 5, 11, 15]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 2 <= [0, 7, 4, 10, 13, 6, 1, 5, 11, 15]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 0 <= [7, 4, 10, 13, 6, 1, 5, 11, 15]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : [7, 4, 10, 13, 6, 1, 5, 11, 15, 12, 0, 18, 16, 2, 3, 19, 8, 14, 17, 9]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 7 <= [4, 10, 13, 6, 1, 5, 11, 15, 12, 0, 18, 16, 2, 3, 19, 8, 14, 17, 9]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 4 <= [10, 13, 6, 1, 5, 11, 15, 12, 0, 18, 16, 2, 3, 19, 8, 14, 17, 9]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 10 <= [13, 6, 1, 5, 11, 15, 12, 0, 18, 16, 2, 3, 19, 8, 14, 17, 9]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 13 <= [6, 1, 5, 11, 15, 12, 0, 18, 16, 2, 3, 19, 8, 14, 17, 9]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 6 <= [1, 5, 11, 15, 12, 0, 18, 16, 2, 3, 19, 8, 14, 17, 9]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 1 <= [5, 11, 15, 12, 0, 18, 16, 2, 3, 19, 8, 14, 17, 9]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 5 <= [11, 15, 12, 0, 18, 16, 2, 3, 19, 8, 14, 17, 9]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 11 <= [15, 12, 0, 18, 16, 2, 3, 19, 8, 14, 17, 9]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 15 <= [12, 0, 18, 16, 2, 3, 19, 8, 14, 17, 9]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.c.RandomIndex            : 12 <= [0, 18, 16, 2, 3, 19, 8, 14, 17, 9]
2024-05-28 22:41:04.150  INFO 4788 --- [main] c.f.h.s.RandomIndexTest        : ------------输入x退出,回车换行继续------------

五、源码传送

https://gitcode.com/00fly/springboot-hello/blob/main/src/main/java/com/fly/hello/web/RestPicController.java

git clone https://gitcode.com/00fly/springboot-hello.git

六、效果演示

在这里插入图片描述


有任何问题和建议,都可以向我提问讨论,大家一起进步,谢谢!

-over-

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1708836.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

blender复制uv贴图

1、新建两个猴头 2、点击其中一个进入uv编辑模式 3、在uv编辑中打开一个图像 4、新建一个材质球&#xff0c;将图像渲染到模型上 打开图像纹理 选择刚才打开的图像 切换到材质预览模式后&#xff0c;就可以看到贴图了 5、选择一个孤岛 6、然后选择拼排孤岛 可以看到该模型展开…

「报名中」5月31日,和PolarDB开源社区一起去娃哈哈!

5月31日&#xff08;周五&#xff09;&#xff0c;PolarDB开源社区将联合娃哈哈集团共同举办开源数据库技术沙龙&#xff01; 本次活动我们邀请到PolarDB产品研发、数据库工具、数据库管控平台、数据库人才教育等各领域专家和老师&#xff0c;参与分享和交流&#xff0c;共同推…

Windows UWP ContentDialog去掉阴影(全透明)的实现

一、前言 在WIndows开发中&#xff0c;使用UWP&#xff08;Universal WIndows&#xff09;项目开发过程中&#xff0c;使用ContentDialog 的过程中&#xff0c;我们可能并不满足现有的样式&#xff0c;这时就需要自定义样式。笔者在自定义样式过程中&#xff0c;遇到了一个难题…

算法002:复写零

力扣&#xff08;LeetCode&#xff09;. - 备战技术面试&#xff1f;力扣提供海量技术面试资源&#xff0c;帮助你高效提升编程技能,轻松拿下世界 IT 名企 Dream Offer。https://leetcode.cn/problems/duplicate-zeros/ 使用 双指针 来解题&#xff1a; 具体思路 如果是和00…

PHP开发入门

PHP官网&#xff1a;PHP: Hypertext Preprocessor apache官网&#xff1a;https://httpd.apache.org/ 一、搭建PHP环境 下载apache 进入官网点击download 选择下载windows版本文件 点击进入下载界面 点击下载64位版本文件 下载后解压文件 解压文件后进入 D:\httpd-2.4.59-24…

百度智能云千帆AppBuilder升级!开放多源模型接入,思考模型再次加速!

>>【v0.5.4版本】 上线时间&#xff1a;2024/5/24 关键发版信息&#xff1a; 大模型优化&#xff1a;开放多源模型接入&#xff0c;思考模型再次加速&#xff01; Agent思考模型&#xff1a;新增AppBuilder专用版模型ERNIE Speed-AppBuilder&#xff0c;自主任务规划…

SQLServer2012实例下某个数据库处于恢复挂起状态

由于机房电源线路故障&#xff0c;导致部分服务器飞正常状态下关机&#xff0c;电源线路重新恢复后&#xff0c;启动服务器后实例下有个数据库都显⽰“恢复挂起”状态&#xff0c;应用程序也⽆法对数据库的正常访问操作。 1、解决关键⽅法&#xff1a; run DBCC CHECKDB on t…

Day 5:2785. 将字符串中的元音字母排序

Leetcode 2785. 将字符串中的元音字母排序 给你一个下标从 0 开始的字符串 s &#xff0c;将 s 中的元素重新 排列 得到新的字符串 t &#xff0c;它满足&#xff1a; 所有辅音字母都在原来的位置上。更正式的&#xff0c;如果满足 0 < i < s.length 的下标 i 处的 s[i] …

中国上市企业行业异质性数据分析

数据简介&#xff1a;企业行业异质性数据是指不同行业的企业在运营、管理、财务等方面的差异性数据。这些数据可以反映不同行业企业的特点、优势和劣势&#xff0c;以及行业间的异质性对企业经营和投资的影响。通过对企业行业异质性数据的分析&#xff0c;投资者可以更好地了解…

2005-2022年各省全体居民人均可支配收入数据(无缺失)

2005-2022年各省全体居民人均可支配收入数据&#xff08;无缺失&#xff09; 1、时间&#xff1a;2005-2022年 2、来源&#xff1a;国家统计局、统计年鉴 3、指标&#xff1a;全体居民人均可支配收入 4、范围&#xff1a;31省 5、缺失情况&#xff1a;无缺失 6、指标解释…

WWW24因果论文(2/8) |多模因果结构学习与根因分析

【摘要】有效的根本原因分析 (RCA) 对于快速恢复服务、最大限度地减少损失以及确保复杂系统的平稳运行和管理至关重要。以前的数据驱动的 RCA 方法&#xff0c;尤其是那些采用因果发现技术的方法&#xff0c;主要侧重于构建依赖关系或因果图来回溯根本原因。然而&#xff0c;这…

2023、2024国赛web复现wp

2023 Unzip 类型&#xff1a;任意文件上传漏洞 主要知识点&#xff1a;软链接 随便上传一个一句话木马文件&#xff0c;得到一串php代码 根据代码上传zip文件发现进入后还是此页面 代码审计&#xff1a; <?php error_reporting(0); highlight_file(__FILE__);$finfo fin…

项目管理基础知识

项目管理基础知识 导航 文章目录 项目管理基础知识导航一、项目相关概念二、时间管理三、人员管理四、风险管理 一、项目相关概念 项目定义的三层意思 一定的资源约束:时间资源、经费资源、人力资源一定的目标一次性任务 里程碑 是项目中的重要时点或事件持续时间为零&…

【仿RabbitMQ消息队列项目day4】GTest测试框架使用

一.什么是GTest? GTest是一个跨平台的 C单元测试框架&#xff0c;由google公司发布。gtest是为了在不同平台上为编写C单 元测试而生成的。 二.使用 TEST(test_case_name, test_name)&#xff1a;主要用来创建⼀个简单测试&#xff0c; 它定义了一个测试函数&#xff0c; 在这个…

Niantic利用Meta Llama让数字生物栩栩如生

每周跟踪AI热点新闻动向和震撼发展 想要探索生成式人工智能的前沿进展吗&#xff1f;订阅我们的简报&#xff0c;深入解析最新的技术突破、实际应用案例和未来的趋势。与全球数同行一同&#xff0c;从行业内部的深度分析和实用指南中受益。不要错过这个机会&#xff0c;成为AI领…

修改了vue3 <script setup>留言板

Лунная ночь <template><button class"edit_view_checkbox"><input type"checkbox" v-model"editshowInput" value"编辑" /></button><div class"editshowInput" v-if"editshowI…

Modal.method() 不显示头部的问题

ant-design中的Modal组件有两种用法&#xff1a; 第一种是用标签&#xff1a;<a-modal></a-modal> 第二种是用Api&#xff1a;Modal.info、Modal.warning、Modal.confirm...... 一开始项目中这两种用法是混用的&#xff0c;后面UI改造&#xff0c;需要统一样式&…

spring boot 项目配置支持https

前言 本地的项目接口 需要支持https访问 准备 java环境 由于我们使用的是java自带的 keytool工具java 生成根证书 环境是必须的 实战 生成 https证书# alias 别名 keystore 存储文件名称 storepass 存储密码 validity 有效期&#xff08;天数&#xff09; keytool -genk…

区块链系统开发测试----链码部署开发、系统开发验证

一.检查配置环境 检查虚拟机环境&#xff0c;确保有正在运行的Hyperledger Fabric区块链&#xff0c;并且其中chaincode_basic、credit_chaincode链码可以正常调用 查看chaincode_basic、credit_chaincode链码调用 二.开发征信链码代码 基于现有征信链码&#xff0c;开发征信…

迁移基于MicroBlaze处理器的设计

迁移基于MicroBlaze处理器的设计 生成系统基础设施&#xff08;MicroBlaze、AXI_Interconnect&#xff0c; Clk_Wiz、Proc_Sys_Reset&#xff09; 生成系统基础设施&#xff08;MicroBlaze、AXI_Interconnect、Clk_Wiz和 Proc_Sys_Reset&#xff09;&#xff1a; 1.使用所需的板…