Oliver Peters <oliver....@web.de> wrote:
> Drake Wilson <dr...@...> writes:
> 
> [...]
> 
>>   sqlite> select a, a+1 from (select random() & 65535 as a);
>>   a       a+1
>>   39692   39693
> 
> [...]
> 
> I'm just a little curious: what is the meaning of the & operator?

Bitwise AND, just like in C.

> What is its effect?

In this case, restricting the return value of random() to 0-65535 range, by 
masking away (clearing, resetting to zero) high order bits. 65535 == 0xFFFF in 
hex == 1111111111111111 in binary.
-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to