mirror of
https://github.com/maxboeck/webring
synced 2025-02-16 17:58:23 +00:00
fix bug in random function
This commit is contained in:
parent
95240a1abe
commit
45987600a0
1 changed files with 3 additions and 3 deletions
|
@ -34,9 +34,9 @@ export const getPrevious = url => {
|
|||
}
|
||||
|
||||
export const getRandom = url => {
|
||||
const randomIndex = Math.floor(Math.random() * members.length)
|
||||
const sites = url
|
||||
const selection = url
|
||||
? members.filter(site => !url.includes(site.url))
|
||||
: members
|
||||
return sites[randomIndex]
|
||||
const randomIndex = Math.floor(Math.random() * selection.length)
|
||||
return selection[randomIndex]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue