use prime number step for Who to follow panel

This commit is contained in:
Hakaba Hitoyo 2018-09-09 14:34:51 +09:00
parent 2eab0cb115
commit 3a17252929

View file

@ -3,9 +3,10 @@ import apiService from '../../services/api/api.service.js'
function showWhoToFollow (panel, reply) { function showWhoToFollow (panel, reply) {
var users = reply var users = reply
var cn var cn
var index = 0 var index
var random = Math.floor(Math.random() * 10) var step = 7
for (cn = random; cn < users.length; cn = cn + 10) { cn = Math.floor(Math.random() * step)
for (index = 0; index < 3; index++) {
var user var user
user = users[cn] user = users[cn]
var img var img
@ -46,11 +47,8 @@ function showWhoToFollow (panel, reply) {
} }
}) })
} }
index = index + 1
if (index > 2) {
break
}
} }
cn = (cn + step) % users.length
} }
function getWhoToFollow (panel) { function getWhoToFollow (panel) {