JuliaLang/julia — pull request #3194 by GunnarFarneback (2013-05-23 21:31:59+00:00)
Title: Improvements of rand(Range1).

This pull request addresses the following shortcomings of the rand(Range1) function.
```julia
julia> rand('a':'z')
ERROR: no method typemax(DataType,)
in rand at random.jl:148

julia> typeof(rand(int32(1):int32(5)))
Int64

julia> rand(int32(-1):typemax(Int32))
[Hangs in infinite loop.]
```
Instead giving:
```julia
julia> rand('a':'z')
'r'

julia> typeof(rand(int32(1):int32(5)))
Int32

julia> rand(int32(-1):typemax(Int32))
1410446553
```