Currently, it is not possible to define an arbitrary range for random. Examples:
if the value is 0, random returns 0
if the value is 1, random returns 1
if the value is -1, random returns -1
if the value is 2, random returns an integer in the 1 to 2 range
if the value is -2, random returns an integer in the -2 to -1 range
, etc.
The problem is that this way it is impossible to define a "full 64-bit range", since the largest range one can obtain is from the minimal integer to -1, i.e., 63 random bits at most. To obtain a full 64-bit range it would be useful to write, e.g.:
random/range to integer! #{8000000000000000} to integer! #{7fffffffffffffff}
Submitted by: Ladislav
Currently, it is not possible to define an arbitrary range for
random
. Examples:value
is 0,random
returns 0value
is 1,random
returns 1value
is -1,random
returns -1value
is 2,random
returns an integer in the 1 to 2 rangevalue
is -2,random
returns an integer in the -2 to -1 range, etc. The problem is that this way it is impossible to define a "full 64-bit range", since the largest range one can obtain is from the minimal integer to -1, i.e., 63 random bits at most. To obtain a full 64-bit range it would be useful to write, e.g.:
Imported from: https://github.com/rebol/rebol-issues/issues/2260
Comments: