简单随机数据算法

文章目录

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

一,需求概述

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

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

二,实现代码

借助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
{@Testpublic 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.mzph.cn/bicheng/18112.shtml

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

相关文章

进程互斥经典问题(读写者问题、理发店问题)

目录 读写者问题 问题描述 问题分析 进程互斥问题三部曲 读者写者算法实现 一、找进程——确定进程关系 二、找主营业务 三、找同步约束 a.互斥 b.资源 c.配额 理发店问题 问题描述 问题分析 进程互斥问题三部曲 理发店问题算法实现 一、找进程——确定进程…

SB-OSC,最新的 MySQL Schema 在线变更方案

目前主流的 MySQL 在线变更方案有两个&#xff1a; 基于 trigger 的 pt-online-schema-change基于 binlog 的 gh-ost 上周 Sendbird 刚开源了他们的 MySQL Schema 在线变更方案 SB-OSC: Sendbird Online Schema Change。 GitHub 上刚刚 25 颗星星&#xff0c;绝对新鲜出炉。 …

Qt Creator(2)【如何在Qt Creator中创建新工程】

阅读导航 引言一、Qt Creator开始界面介绍二、如何在Qt Creator中创建新工程1. 新建项目2. 选择项目模板3. 选择项目路径4. 选择构建系统5. 填写类信息设置界面6. 选择语言和翻译文件7. 选择Qt套件8. 选择版本控制系统9. 最终效果 三、认识Qt Creator项目内容界面1. 基本界面2.…

go语言初识别(五)

本博客内容涉及到&#xff1a;切片 切片 1. 切片的概念 首先先对数组进行一下回顾&#xff1a; 数组定义完&#xff0c;长度是固定的&#xff0c;例如&#xff1a; var num [5]int [5]int{1,2,3,4,5}定义的num数组长度是5&#xff0c;表示只能存储5个整形数字&#xff0c…

检索模型预训练方法:RetroMAE

论文title&#xff1a;https://arxiv.org/pdf/2205.12035RetroMAE: Pre-Training Retrieval-oriented Language Models Via Masked Auto-Encoder 论文链接&#xff1a;https://arxiv.org/pdf/2205.12035 摘要 1.一种新的MAE工作流&#xff0c;编码器和解器输入进行了不同的掩…

华为OD机试【计算最接近的数】(java)(100分)

1、题目描述 给定一个数组X和正整数K&#xff0c;请找出使表达式X[i] - X[i1] … - X[i K 1]&#xff0c;结果最接近于数组中位数的下标i&#xff0c;如果有多个i满足条件&#xff0c;请返回最大的i。 其中&#xff0c;数组中位数&#xff1a;长度为N的数组&#xff0c;按照元…

软件性能测试有哪些测试类型和方法?

软件性能测试是一种通过模拟真实用户使用情况&#xff0c;评估软件系统在各种压力和负载下的表现的测试方法。在今天这个讲究效率的时代&#xff0c;软件性能测试是不可或缺的一环。它能帮助开发人员和企业发现潜在的性能问题&#xff0c;提前优化改进&#xff0c;保证软件系统…

动态内存管理—C语言通讯录

目录 一&#xff0c;动态内存函数的介绍 1.1 malloc和free 1.2 calloc 1.3 realloc 1.4C/C程序的内存开辟 二&#xff0c;通讯录管理系统 动态内存函数的介绍 malloc free calloc realloc 一&#xff0c;动态内存函数的介绍 1.1 malloc和free void* malloc (…

回文链表(快慢指针解法之在推进过程中反转)

归纳编程学习的感悟&#xff0c; 记录奋斗路上的点滴&#xff0c; 希望能帮到一样刻苦的你&#xff01; 如有不足欢迎指正&#xff01; 共同学习交流&#xff01; &#x1f30e;欢迎各位→点赞 &#x1f44d; 收藏⭐ 留言​&#x1f4dd;抱怨深处黑暗&#xff0c;不如提灯前行…

代码随想录算法训练营day14|二叉树的递归遍历、二叉树的迭代遍历、二叉树的统一迭代法

二叉树的递归遍历 首先需要明确的一点是&#xff0c;前序中序和后序在二叉树的递归遍历中的区别仅在于递归函数中操作的顺序&#xff0c;前序是在遍历一个节点的左右子树前进行操作&#xff0c;中序是在遍历一个节点的左子树后进行操作再遍历右子树&#xff0c;而后序是在遍历…

C++算术运算和自增自减运算

一 引言 表示运算的符号称为运算符。 算术运算&#xff1b; 比较运算&#xff1b; 逻辑运算&#xff1b; 位运算&#xff1b; 1 算术运算 算术运算包括加、减、乘、除、乘方、指数、对数、三角函数、求余函数&#xff0c;这些都是算术运算。 C中用、-、*、/、%分别表示加、减…

《当微服务遇上Ribbon:一场负载均衡的华丽舞会》

在微服务的厨房里&#xff0c;如何确保每一道服务都恰到好处&#xff1f;揭秘Spring Cloud Ribbon如何像大厨一样精心调配资源&#xff0c;让负载均衡变得像烹饪艺术一样简单&#xff01; 文章目录 Spring Cloud Ribbon 详解1. 引言微服务架构中的负载均衡需求Spring Cloud Rib…

【算法实战】每日一题:设计一个算法,用最少数量的矩形覆盖一系列宽度为d、高度为w的矩形,且使用矩形不能超出边界

题目 设计一个算法&#xff0c;用最少数量的矩形覆盖一系列宽度为d、高度为w的矩形建筑物侧墙&#xff0c;且矩形不能超出边界。 核心思路 考虑这种结构 前面递增后面一个与前面的某个高度一致&#xff0c;这时候考虑最下面的覆盖&#xff08;即都是从最下面向上覆盖&#…

redis数据类型set,zset

华子目录 Set结构图相关命令sdiff key1 [key2]sdiffstore destination key1 [key2...]sinter key1 [key2...]sinterstore destination key1 [key2...]sunion key1 [key2...]sunionstore destination key1 [key2...]smove source destination memberspop key [count]sscan key c…

Java GC问题排查的一些个人总结和问题复盘

个人博客 Java GC问题排查的一些个人总结和问题复盘 | iwts’s blog 是否存在GC问题判断指标 有的比较明显&#xff0c;比如发布上线后内存直接就起飞了&#xff0c;这种也是比较好排查的&#xff0c;也是最多的。如果单纯从优化角度&#xff0c;看当前应用是否需要优化&…

Unity实现首行缩进两个字符

效果 在Unity中如果想实现首行缩进两个字符&#xff0c;你会发现按空格是没法实现的。 实现原理&#xff1a;用空白的透明的字替代原来的位置。 代码&#xff1a; <color#FFFFFF00>XXX</color> 赶紧去试试吧&#xff01;

备战秋招—模拟版图面试题来了

随着暑期的脚步逐渐临近&#xff0c;电子工程和集成电路设计领域的毕业生们&#xff0c;也将迎来了另一个求职的黄金期——秋招。我们总说机会是留给有准备的人。对于有志于投身于模拟版图设计的学子们来说&#xff0c;为了在众多求职者中脱颖而出&#xff0c;充分备战模拟版图…

C# 工商银行缺少infosecapiLib.infosec

搜索Tlbimp.exe 这里使用4.8.1下的处理&#xff0c;以管理员身份打开powershell cd "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8.1 Tools".\TlbImp.exe "G:\CSharp\icbc-api-sdk-cop-c#\sdk-cop\sdk-cop\dll\infosecapi.dll" …

PCIe协议之-DLLP详解

✨前言&#xff1a; &#x1f31f;数据链路层的功能 数据链路层将从物理层中获得报文&#xff0c; 并将其传递给事务层&#xff1b; 同时接收事务层的报文&#xff0c; 并将其转发到物理层; 核心的功能有以下三点 1.保证TLP在 PCIe 链路中的正确传递; 2.数据链路层使用了容错…

杀死那个进程

一、场景 eclipse在启动tomcat时&#xff0c;出现端口被占用的情况。我寻思着“任务管理器”没出现相应程序在跑啊。 1.1问题&#xff1a;端口和进程的关系 端口和进程之间存在着一种关系&#xff0c;端口是一个逻辑概念&#xff0c;它用于标识网络通信中的一个终点&#xff0…