the hole explanation is: I modified your select a bitt get a result for the random() function
sqlite> select b,a, b & a from (select random() as b, 65535 as a); -3252060536130257049|65535|48999 So I got these results b = -3252060536130257049 in decimal form b = 1101001011011110010111000010110000101011111000111011111101100111 in binary a = 65535 in decimal a = 1111111111111111 in binary b & a = 48999 in decimal b & a = 1011111101100111 result in binary The explanation is the AND operator takes the random() number witch is a fraction between 0 and 1 and compares all the bits to all the bits of the number 65535 and creates a result it sort of mutiplying a fraction with 65535 and the result is a number between 0 and 65534 AND : & A bitwise AND takes two binary representations of equal length and performs the logical AND operation on each pair of corresponding bits. In each pair, the result is 1 if the first bit is 1 AND the second bit is 1. Otherwise, the result is 0. For example: 0101 (decimal 5) AND 0011 (decimal 3) = 0001 (decimal 1) In the C programming 1101001011011110010111000010110000101011111000111011111101100111 0000000000000000000000000000000000000000000000001111111111111111 ================================================================ 0000000000000000000000000000000000000000000000001011111101100111 _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users