const { length, list, nth, List } = require("list")
const random = function (l) {
return nth(Math.floor(Math.random() * length(l)), l)
}
List.prototype.random = function () {
return nth(Math.floor(Math.random() * length(this)), this)
}
const aList = list(1, 2, 3, 4)
;
[ random(aList)
, aList.random()
]