This is an old topic. (I've seen another big thread on it but can't find it.)
My issue with this approach is the meaningless 0 and the <. If you're going to disregard the argument, it could be anything. E.g.
stride(from: 0, to: 1000, by: 10)
I don't think polluting Array was or is the way to go. Array was just more of a go-to in the early days. map is fine; it just needs a better iterator to work off of.
func `repeat`(count: Int) -> some Sequence<Void> {
repeatElement((), count: count)
}
`repeat`(count: 100).map { Int.random(in: 0...100) }