Best way to generate vector of tuples based on two vectors

K5Julien
Wed, 31 Jul 2024 17:11:09 +0000
Performance

The following does what I want, generate a vector of tuples thanks to the two vectors that I provide.

xycoordinates = Tuple{Int,Int}[(x,y) for x in collect(1:10), y in rand(1:10, 10)]

I wanted to know if there exists a better way for doing this or is it already optimal, in terms of code readability and conciseness.

5 posts - 4 participants