Quick way to create a vector of only rationals wthin a range?

Hi all,
I want to create a vector of 30 rational numbers between 10^(-5) to 10^(-1). Preferably evenly spaced.
Is there a quick and efficient way to do it in Julia?

Thank you!

Depends on what you mean by ‘evenly spaced’

For linear spacing:

range(start=1//100000, length=30, stop=1//10)

For log spacing, maybe

rationalize.(10 .^ range(start=-5, length=30, stop=-1))
2 Likes

Technically, all finite floating-point values are rational, so no need to use Rational here.