Specifying range in RandomReal
Not with RandomReal
that I know of, but you can define a UniformDistribution
with your required limits and draw samples from it using RandomVariate
:
pts = RandomVariate[UniformDistribution[{{0, 1}, {0, 10}}], 20]
Check that it works as expected:
MinMax /@ Transpose@pts
{{0.00103093, 0.996982}, {0.530043, 9.94596}}
Just marginally faster
x = 1; y = 10; L = 20;
Transpose[{RandomReal[x, L], RandomReal[y, L]}]; // RepeatedTiming
{4.2*10^-6,Null}
ReIm@RandomComplex[{0, x + I y}, L]; // RepeatedTiming
{2.5*10^-6,Null}