I want to select all datasets within a range from 0 to a generated random number.

This works:

```
@test = Test.where( :level => 0..4 )

```

This doesn't work:

```
@test = Test.where( :level => 0..rand(4) )

```

If I put **rand(4)** as the upper limit of the range I don't get any result. Why? How can I do it?

Thanks

Edit: Sorry, I was not aware that rand(4) means that 4 is not in the range and that 3 is the maximum result. I solved this now. Thank you.