对网易云性格主导色实现与算法的简要分析
昂神盛情相邀,遂有此文
测试过程
简单测试
- 多次选择固定选项,观察结果,发现存在结果不同的情况
- 具体的,笔者选择位于屏幕最上方的选项,发现答案可能是橙绿或蓝紫,且蓝紫几率较大
抓包测试
- 初始化完成后,采用Fiddler进行请求拦截,如下图
- 发现不需要联网,可以做完全部题目(但图片和音频无法加载,可能是存在懒加载机制),直到获取结果时无法继续
- 获取结果时,发现两个必须的关键POST包weblog和antispam
- 使用Fiddler解密,可以发现weblog用于握手
- 使用Fiddler解密,antispam传输未知字符串,但诡异之处在于返回值并不是测试结果
Network分析
- 通过Network对antispam进行分析,如下图所示,既然加密在前端进行,我们就有机会找出被加密前的内容
- 搜索字符串encSecKey,可以找到下面的JavaScript,并利用Chrome对进行格式化
- 在格式化后的JavaScript中搜索encSecKey,找到下图所示的代码段,对相关代码打断点后刷新
- 通过前端单步调试,可以获取加密前的内容,去除无关内容后,发现传输的只是姓名字符串,如下图所示
本机JavaScript分析
- 由上述内容可知,我们的选择没有被上传,那只可能在本地处理,为此只需要分析全部click事件(也可以从别的角度分析,click事件是笔者选择的切入点)
- 通过分析可以找到以下JavaScript,格式化后浏览其中的内容可以明显看出端倪,阅读此JavaScript中的代码即可得到测试算法,如下图
算法解析
算法流程描述如下
第一阶段
- 每一题的的每个选项打若干颜色标签(使用下面给出的表1),统计前七题对应选项七个标签集的颜色频率和
- 以第一题选择A为例,第一题A选项的标签是
["金", "绿"]
,如果选择了第一题A选项,那么金绿两个颜色的频率分别加一 - 这一段的代码如下
var n, r, o, t = e.length, i = {}; if (e.slice(0, t - 1).forEach(function(e, t) { return v(i, e, t) }), ...
- 其中e是选项id数组,
e.slice(0, t - 1)
实现了对数组除最后一项的拷贝 - v函数如下所示
function v(t, e, n) { p[n][e - 1].forEach(function(e) { t[e] = t[e] ? t[e] + 1 : 1 }) }
- 这里的t是传入的i,i是一个dict,类似Python中的dict,CPP中的unordered_map或者java中的HashMap,实现key到value的映射,这一段代码的意思是如果存在就加一,不存在就置一
- 以第一题选择A为例,第一题A选项的标签是
- 从颜色到频率的映射改为从频率到颜色的映射,如果存在重复,随机保留一个
- 这一段的代码如下,理解了上一段的话,这一段是比较好理解的
n = i, r = !1, o = {}, Object.keys(n).forEach(function(e) { var t = n[e]; o[t] && (r = !0), o[t] = e }),
- 这里没有显式的随机,而是只保留了遍历dict时最先遍历的结果
- 这一段的代码如下,理解了上一段的话,这一段是比较好理解的
- 如果没有遇到频率重复,额外更新第八题的频率
- 这一段的代码如下,这里利用的短路求值特性
r && v(i, e[t - 1], t - 1),
- 短路求值是指,A或B若A为真,不执行B直接返回,A且B若A为假,不执行B直接返回,接下来的代码中这一性质被多次使用
- 这一段的代码如下,这里利用的短路求值特性
- 每一题的的每个选项打若干颜色标签(使用下面给出的表1),统计前七题对应选项七个标签集的颜色频率和
第二阶段
- 上面的代码全部在一个if的条件中,而if的条件以下面的代码结束,彼此以逗号连接
- 这一段的代码如下
2 !== e[7]
- 由逗号表达式的性质,逗号表达式的返回值是最后一个逗号之后的表达式的返回值,即最终决定执行哪一分支的,是第八题的结果
- 这一段的代码如下
- 考虑第八题结果,如果选A
- 遍历下面给出的表2,寻找项内两元素频率和最大者,将两元素拼接作为结果
- 表内的项有两个元素,形如
["粉", "金"]
- 这一段的代码如下,通过传入一个函数定义计算奖励值的方式
(a = N(m, function(e) { return i[e[0]] + i[e[1]] }).join(""))
- 被调用的N函数如下,选择奖励值即项内两元素频率和最大者
function N(e, n) { var r, o = -1; return e.forEach(function(e, t) { e = n(e); o < e && (o = e, r = t) }), e[r] }
- 表内的项有两个元素,形如
- 如果得到的结果是橙绿,有0.5的几率变为蓝紫
- 这一段的代码如下,实现时依旧使用了短路求值和逗号表达式的特性
return "橙绿" === (a = N(m, function(e) { return i[e[0]] + i[e[1]] }).join("")) && .5 < Math.random() && (a = "蓝粉"), a;
- 这一段的代码如下,实现时依旧使用了短路求值和逗号表达式的特性
- 遍历下面给出的表2,寻找项内两元素频率和最大者,将两元素拼接作为结果
- 考虑第八题结果,如果选B
- 遍历下面给出的表3,寻找频率最大者,将其作为结果
- 表内的项有一个元素,形如
"绿"
- 这一段的代码如下,依旧通过传入一个函数定义计算奖励值的方式
var a = N(h, function(e) { return i[e] });
- 被调用的N函数同上,N函数设计的精妙之处在于传入一个函数参数,这种设计思想在C语言的qsort和bsearch函数中也有使用
- 表内的项有一个元素,形如
- 如果得到的结果是绿,有0.5的几率变为蓝,与上面的内容无本质区别,不再赘述
- 这一段的代码如下
return "绿" === a && .5 < Math.random() && (a = "蓝"), a
- 这一段的代码如下
- 遍历下面给出的表3,寻找频率最大者,将其作为结果
- 上面的代码全部在一个if的条件中,而if的条件以下面的代码结束,彼此以逗号连接
- 算法最终返回一个字符串,作为dict的key使用(测试的最终结果一共16种,已全部附于文后)
算法补充分析如下
- 大量使用短路求值/函数参数,命名经过了混淆处理,阅读理解障碍较大
- 一个比较直观的结果,最后一题选上面的选项,得到双色,否则得到单色
给出上文提到的三个表
- 表1(截取自上述JS,进行了格式化)
p = [ [["金", "绿"], ["紫", "银", "橙"], ["粉", "蓝"]], [["蓝", "紫"], ["粉", "橙"], ["银", "金", "绿"]], [["银", "紫", "橙"], ["蓝", "绿"], ["金", "粉"]], [["银", "橙"], ["紫", "金", "绿"], ["粉", "蓝"]], [["绿", "紫"], ["橙", "粉"], ["银", "金", "蓝"]], [["绿", "紫", "银"], ["蓝", "橙"], ["金", "粉"]], [["绿", "金", "紫"], ["橙", "粉"], ["银", "蓝"]], [["紫", "橙", "绿", "银"], ["蓝", "金", "粉"]] ],
- 表2(截取自上述JS,进行了格式化)
m = [ ["粉", "金"], ["金", "橙"], ["粉", "紫"], ["金", "蓝"], ["金", "紫"], ["橙", "粉"], ["蓝", "粉"], ["金", "绿"], ["橙", "绿"] ],
- 表3(截取自上述JS,进行了格式化)
h = ["绿", "橙", "银", "紫", "蓝", "金", "粉"]
- 表1(截取自上述JS,进行了格式化)
给出实现中的三个关键函数
- 函数1(截取自上述JS,进行了格式化)
function v(t, e, n) { p[n][e - 1].forEach(function(e) { t[e] = t[e] ? t[e] + 1 : 1 }) }
- 函数2(截取自上述JS,进行了格式化)
function N(e, n) { var r, o = -1; return e.forEach(function(e, t) { e = n(e); o < e && (o = e, r = t) }), e[r] }
- 函数3(截取自上述JS,进行了格式化)
function y(e) { var n, r, o, t = e.length, i = {}; if (e.slice(0, t - 1).forEach(function(e, t) { return v(i, e, t) }), n = i, r = !1, o = {}, Object.keys(n).forEach(function(e) { var t = n[e]; o[t] && (r = !0), o[t] = e }), r && v(i, e[t - 1], t - 1), 2 !== e[7]) return "橙绿" === (a = N(m, function(e) { return i[e[0]] + i[e[1]] }).join("")) && .5 < Math.random() && (a = "蓝粉"), a; var a = N(h, function(e) { return i[e] }); return "绿" === a && .5 < Math.random() && (a = "蓝"), a }
- 函数1(截取自上述JS,进行了格式化)
全部从颜色到完整结果的定义如下
"蓝": { singleName: "天空蓝", percent: "20.03", peoplecount: 5, otherPeople: "蓝", otherPeopleText: "外在蓝色的人拥有大局观和战略思维!\n你向外界舒适地展示着自我,在规则世界中自在穿行!\n蓝色的人聪明有灵气,总能轻易得到大家的欣赏和支持!", infact: "蓝", infactText: "极端的蓝色,是非常少见的组合!\n你最强大的力量在于感知,洞察和直觉!\n蓝色以其深邃灵魂和智慧,带给自己和他人幸运和奇迹!", oneWord: "魅力超凡的艺术家", attracted: ["橙粉", "粉金"], keepAway: ["金", "银"], songName: "Mia & Sebastian's Theme", songId: "499771852", songUrl: "https://m7.music.126.net/20890607234532/9beabe0be8d76c36101056502612d875/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/9049775496/aed6/ea0d/61ae/9d2b81cd492231c1fc21b2d15a82550a.mp3?infoId=1348305", keywordOther: "冷静、睿智、纵览全局", keywordInfact: "感性、浪漫、以人为本", percentGlobal: "2.47" }, "金": { singleName: "闪耀金", percent: "26.46", peoplecount: 4, otherPeople: "金", otherPeopleText: "外在金色的人,是领导者的代名词。\n在复杂的问题面前,金色总能够迅速掌握全局。\n金色的人永远在努力,永远可靠,永远帮得上忙!", infact: "金", infactText: "极端金色是极具天赋、极其罕见的组合!\n他们有能力让混乱和崩溃的事情重回正轨。\n虽然你处事低调沉稳,但你总是人群中的焦点。", oneWord: "夏日初升的太阳", attracted: ["粉紫", "金橙"], keepAway: ["蓝", "橙粉"], songName: "building a family ", songId: "17239379", songUrl: "https://m8.music.126.net/20890608132050/fa39b280732b262920fe28d3d170562a/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/9060408876/b43b/597d/a3fb/5a44927f5b28e9eed8fc136ead5dbd4e.mp3?infoId=1348308", keywordOther: "领导力、正义、勤奋", keywordInfact: "勇气、无私、责任心", percentGlobal: "3.04" }, "橙": { singleName: "活力橙", percent: "51.86", peoplecount: 2, otherPeople: "橙", otherPeopleText: "外在橙色的人 是高能量的乐观主义者!\n橙色的人天生聪明,有才能,有资源!\n你自带元气,可以在复杂世界里闯荡得游刃有余!", infact: "橙", infactText: "极致橙色的气质是世间少有的!\n行动是橙色的核心,你对想做的事情有无限的驱动力!\n你是个百分百的生活冒险家,也总能获得命运的偏爱!", oneWord: "云隙射下的阳光", attracted: ["金绿", "粉"], keepAway: ["金蓝", "紫"], songName: "warm zephyr", songId: "1486146637", songUrl: "https://m8.music.126.net/20890608132006/fdcf8561e0f1bcf6d4c4ac527e53f8c9/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/9060403238/cde8/ca24/598f/f1775c16109ef477e3008bc5839b8432.mp3?infoId=1345282", keywordOther: "热忱、高能量、有朝气", keywordInfact: "有趣、温暖、幸福", percentGlobal: "4.33" }, "绿": { singleName: "森林绿", percent: "19.89", peoplecount: 5, otherPeople: "绿", otherPeopleText: "外在绿色的人浑身散发着知性的优雅!\n你自在地穿梭在知识的海洋中,有很强的领悟能力!\n绿色善于思考,经常提出惊艳全场的新观点!", infact: "绿", infactText: "极端绿色的人是非常少见的!\n只有极端绿色的人才能在危机中保持清醒,解决问题!\n绿色是最有安全感的颜色,大家都在寻找极端绿色当伙伴!", oneWord: "智慧非凡的开拓者", attracted: ["橙", "蓝粉"], keepAway: ["粉金", "金蓝"], songName: "夏末的心愿", songId: "1492668093", songUrl: "https://m8.music.126.net/20890607234949/f93daf3f1b2749806bb5c7eab39ff188/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/9049868606/e7af/a4bd/c5d6/07bf410d12a5e56f85c7080204f6b6ac.mp3?infoId=1345281", keywordOther: "冷静、独立、有逻辑", keywordInfact: "清醒、舒适、包容", percentGlobal: "3.92" }, "银": { singleName: "太空银", percent: "33.71", peoplecount: 3, otherPeople: "银", otherPeopleText: "外在银色的人,身上有与生俱来的高贵气质!\n你举手投足间优雅大方,自带闪亮光环!\n银色的人品味很高,不断为自己和他人的生活提升质感!", infact: "银", infactText: "极端的银色是极其罕见的!\n你优雅克制的背后,有着很强的洞察和创造力!\n极端银色是宇宙的礼物,你的心中自有星辰与月光!", oneWord: "漫步银河的梦想家", attracted: ["金橙", "橙绿"], keepAway: ["蓝", "橙粉"], songName: "Cornfield Chase", songId: "29734857", songUrl: "https://m7.music.126.net/20890613011419/2780fefd131d4343524bc1eaef0c63d0/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/9123098244/5727/8c94/768c/89ebf9ac9d08ccdeedd7aa1e30b4dadc.mp3?infoId=1348317", keywordOther: "高贵、优雅、有质感", keywordInfact: "洞察、创造力、有天赋", percentGlobal: "4.53" }, "粉": { singleName: "玫瑰粉", percent: "59.26", peoplecount: 2, otherPeople: "粉", otherPeopleText: "外在粉色的人内心纯粹而温暖!\n你简单而敏锐,世间美好都逃不过你的眼睛!\n你用单纯、体贴、无条件的爱,让世界明亮起来!", infact: "粉", infactText: "极端粉色的人群是极其罕见的!\n你纯洁有信念,拥有所有颜色中最神奇的治愈能力!\n其他颜色忙于操纵结果,但奇迹往往发生在极端粉色中!", oneWord: "世间美好收藏家", attracted: ["橙", "金蓝"], keepAway: ["金绿", "金橙"], songName: "和煦的糖果风", songId: "439142564", songUrl: "https://m701.music.126.net/20890607233630/32defc3ba8c28bfdd28d4f01e38fb38d/jdymusic/obj/w5zDlMODwrDDiGjCn8Ky/1528388451/dd07/8dd3/56f7/db1b88989c40393b730277972e7a52bb.mp3?infoId=1346360", keywordOther: "单纯、体贴、温暖", keywordInfact: "纯粹、柔和、治愈", percentGlobal: "2.57" }, "紫": { singleName: "梦幻紫", percent: "31.56", peoplecount: 3, otherPeople: "紫", otherPeopleText: "外在紫色的人气场神秘而梦幻!\n你通常很精致,而且风格多变、难以捉摸!\n紫色的人仿佛被命运偏爱,有着令人嫉妒的艺术天赋!", infact: "紫", infactText: "极端的紫色相当少见! \n你与浪漫的气质撞个满怀,是人群之中最耀眼的存在!\n极端紫色的人从不循规蹈矩,能将创造力发挥到极致!", oneWord: "\n浪漫的神秘主义者\n", attracted: ["粉金", "粉紫"], keepAway: ["橙", "金紫"], songName: "under the stars", songId: "1814213458", songUrl: "https://m8.music.126.net/20890608132145/d7867ed638b6284752022180f3c49ddc/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/9060418519/a288/7f59/86b9/1e2f5b392f4c4286adc6a3e389f33551.mp3?infoId=1346364", keywordOther: "神秘、优雅、耀眼", keywordInfact: "浪漫、克制、梦幻", percentGlobal: "4.14" }, "金蓝": { percent: "22.45", peoplecount: 4, otherPeople: "金", otherPeopleText: "外在的金色百分百努力,是一路前行的奋斗家!\n你有很高的预设目标,以不断突破为行为准则!\n金色的人永远在努力,永远可靠,永远帮得上忙!", infact: "蓝", infactText: "内在蓝色是真正属于智者的灵魂!\n你最强大的力量在于感知,洞察和直觉!\n蓝色以其深邃灵魂和智慧,带给自己和他人幸运和奇迹!", oneWord: "夜空中的璀璨星海", attracted: ["粉", "橙绿"], keepAway: ["橙", "绿"], songName: "Historiette #5", songId: "17239379", songUrl: "https://m7.music.126.net/20890607234038/d14b750c61c06d5054b41a68297c6157/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/9049666252/7646/3696/69cf/32132bbed9479ed9e6a36a224b5fe16f.mp3?infoId=1345279", keywordOther: "领导力、正义、勤奋", keywordInfact: "感性、浪漫、以人为本", percentGlobal: "2.93" }, "金橙": { percent: "37.46", peoplecount: 3, otherPeople: "金", otherPeopleText: "外在金色的人是天生的领导者!\n你总能在危机中保持镇静的头脑,带领大家前进!\n认真威严的金色有时候会有距离感,但责任感超强!", infact: "橙", infactText: "内在橙色的人,专业严肃的背后藏着一颗童心!\n你看起来一丝不苟,内心却燃烧着活力和创新的能量!\n橙色的人具备超乎常人的胆识,是行动力最强的颜色!", oneWord: "黎明闪耀的霞光", attracted: ["银", "金蓝"], keepAway: ["粉", "蓝粉"], songName: "被时光移动的城市", songId: "26524326", songUrl: "https://m7.music.126.net/20890608132321/5c3d9ee60e22560c7c0a498d600e9d7a/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/9060433920/9355/6bba/d452/3ae2d230bd66999b58eb57f4bb36ec98.mp3?infoId=1348309", keywordOther: "领导力、正义、勤奋", keywordInfact: "有趣、温暖、幸福", percentGlobal: "3.92" }, "金绿": { percent: "17.44", peoplecount: 5, otherPeople: "金", otherPeopleText: "外在金色的人,有一点工作狂倾向!\n你能保证规则的顺利运行,是值得信赖的同事和朋友!\n金色的人注重细节,浑身散发着可靠的魅力和高级质感!", infact: "绿", infactText: "内在绿色的人,少年气永不过期!\n你充满热爱且勇于追求理想,纯粹的让人妒忌!\n绿色的人生活既有灵性的深度,又有世俗的成功!", oneWord: "充满远见的哲学家", attracted: ["橙", "金紫"], keepAway: ["粉", "蓝粉"], songName: "leaves in the wind", songId: "19934760", songUrl: "https://m7.music.126.net/20890608131937/385f06b52f6fe09a8a689cc08697e7b1/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/9060397244/54eb/5146/3f5e/4525352be66786c7ed34000a1fa74d14.mp3?infoId=1346362", keywordOther: "领导力、正义、勤奋", keywordInfact: "清醒、舒适、包容", percentGlobal: "2.29" }, "橙粉": { percent: "41.59", peoplecount: 2, otherPeople: "橙", otherPeopleText: "外在橙色的人,是高能量的乐观主义者!\n你能为团队带来惊奇的贡献!是人群中的聚光灯!\n橙色的人被充沛的精力包围,你的无限活力令人惊叹!", infact: "粉", infactText: "内在粉色的人,心思敏感而柔软!\n无限活力的背后,细腻和安静是你对待世界的另一面!\n粉色在体察浪漫上有独家天赋,是最温柔善良的颜色!", oneWord: "海平面初升的阳光", attracted: ["橙绿", "蓝粉"], keepAway: ["金", "银"], songName: "lazy afternoon", songId: "29049489", songUrl: "https://m7.music.126.net/20890607233849/0e96612a759def67fbda27bc1c878eaf/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/2593302435/7a79/7078/2352/2ff263188f0ff4d3e4d4957fcf04e7e8.mp3?infoId=1347334", keywordOther: "热忱、高能量、有朝气", keywordInfact: "纯粹、柔和、治愈", percentGlobal: "3.6" }, "蓝粉": { percent: "59.99", peoplecount: 2, otherPeople: "蓝", otherPeopleText: "外在蓝色的人,注定要扮演引领全局角色!\n你向外界舒适地展示着自我,慷慨地向同伴提供支持!\n蓝色的人眼光长远,总能用实力书写成功和美好!", infact: "粉", infactText: "内在粉色的人,眼睛里充满温柔气息!\n你对待他人和自我都很贴心,容易让人感受到温暖!\n虽然你一路披荆斩棘,但不影响你成为一个仁慈善良的人!", oneWord: "天边透亮的星", attracted: ["绿", "橙粉"], keepAway: ["金橙", "金绿"], songName: "13 jours en France / Piano Solo", songId: "1343379745", songUrl: "https://m8.music.126.net/20890607234458/dec8b682232e1ef6697294f284f82c74/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/9049762452/4932/829f/8e6d/b8779c96f4b25c9b6770627742ae34b4.mp3?infoId=1345280", keywordOther: "冷静、睿智、纵览全局", keywordInfact: "纯粹、柔和、治愈", percentGlobal: "2.56" }, "粉金": { percent: "34.61", peoplecount: 3, otherPeople: "粉", otherPeopleText: "外在粉色的人,举手投足是温柔!\n你善于发现大自然的美好,是浪漫和氛围感的化身!\n粉色的人充满关切,不断向周围人散播着温暖与爱!", infact: "金", infactText: "内在金色的人,是与生俱来的带头人!\n你关注细节与规则,有一点完美主义,努力且高产!\n内在金色的人已臻成熟,内外统整,能成为自己生命主宰!", oneWord: "绚丽夺目的晚霞", attracted: ["蓝", "紫"], keepAway: ["绿", "金紫"], songName: "遇晴", songId: "1495115654", songUrl: "https://m7.music.126.net/20890607234631/8f915cb6203b84305c4e1c6b74b7b355/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/9049794516/7894/7df9/b202/b4f33e7aabe9a00face7dd00b64120f4.mp3?infoId=1348306", keywordOther: "单纯、体贴、温暖", keywordInfact: "勇气、无私、责任心", percentGlobal: "2.43" }, "粉紫": { percent: "51.78", peoplecount: 2, otherPeople: "粉", otherPeopleText: "外在粉色的人善于倾听,浑身散发着治愈的能量!\n你待人诚恳,与你共处的时光让人觉得心旷神怡!\n粉色的人共情力很强,很少有你不能理解的立场和观点!", infact: "紫", infactText: "内在紫色的人,是最神秘难以捉摸的颜色!\n思想深邃的你,最强大的力量在于感知,洞察和直觉!\n紫色的人就是魔法师,往往能实现不可思议的愿望!", oneWord: "神秘温柔的疗愈师", attracted: ["金", "紫"], keepAway: ["橙绿"], songName: "dane street", songId: "2640613", songUrl: "https://m8.music.126.net/20890607234128/62abf412c5eb36f8269df617c3301e11/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/9049683842/19f4/da95/5c5e/b141bc3fa02a0daaec72a0d13f5a0cb8.mp3?infoId=1347335", keywordOther: "单纯、体贴、温暖", keywordInfact: "浪漫、克制、梦幻", percentGlobal: "3.13" }, "橙绿": { percent: "26.57", peoplecount: 4, otherPeople: "橙", otherPeopleText: "外在橙色的人,是高能量的乐观主义者!\n你能为团队带来惊奇的贡献!是人群中的聚光灯!\n橙色的人被充沛的精力包围,你的无限活力令人惊叹!", infact: "绿", infactText: "内在绿色的人拥有真正智者的灵魂,逻辑至上!\n绿色是最机敏聪慧的颜色,热爱思考,有真知灼见!\n你善于解决问题并不断创造新的观点,总是令人振奋!", oneWord: "绚烂而璀璨的极光", attracted: ["金", "银"], keepAway: ["粉紫"], songName: "Belonging", songId: "1823125", songUrl: "https://m7.music.126.net/20890612232945/17fe4c2dd4026c7751ad8ffb95012739/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/9121633586/bc14/de3b/2cc0/7554e49ff87b49b8072afdbb8c526e85.mp3?infoId=1348315", keywordOther: "热忱、高能量、有朝气", keywordInfact: "清醒、舒适、包容", percentGlobal: "2.88" }, "金紫": { percent: "33.67", peoplecount: 3, otherPeople: "金", otherPeopleText: "金色是所有颜色中最值得信赖的!\n你有着奢侈品般的高标准,自己就是自己的品牌!\n金色的人认真可靠,拜托你的事情可以安心等待好消息!", infact: "紫", infactText: "内在紫色的人,拥有浑然天成的洞察力和浪漫基因!\n你仿佛被命运偏爱,有着令人嫉妒的艺术天赋!\n紫色的人就是魔法师,总能实现不可思议的愿望!", oneWord: "流光溢彩的钻石", attracted: ["绿", "金绿"], keepAway: ["紫", "粉金"], songName: "バラのように咲く", songId: "1992713", songUrl: "https://m8.music.126.net/20890612230932/946e18167dcba479846d54a134d4901e/ymusic/obj/w5zDlMODwrDDiGjCn8Ky/9121399218/5fc6/bbc9/9a7c/152d0243d164515b75f0a28709086b5c.mp3?infoId=1346372", keywordOther: "领导力、正义、勤奋", keywordInfact: "浪漫、克制、梦幻", percentGlobal: "4.26" }
结语
- 如下图,大师不愧是大师,构造的算法凭借精妙的随机让一般人叹为观止,事实上,随机是算法中重要的一环
- 我想,这位大师一定非常喜欢Treap吧,把FHQ Treap奉为信仰的我和这位大师也算是心有灵犀呢
- 最后,让我们心怀敬仰的写出如下代码,结束本文
std::mt19937 generator(0x114514);