On 8 Jan 2018, at 9:55pm, Shane Dev <devshan...@gmail.com> wrote:

> The statement -
> select cast(round(abs(random())/9223372036854775808) as int)
> means I want sqlite to toss a virtual coin and return 0 or 1.

Your code is meant to be self-documenting.  Any time you find a number like 
9223372036854775808 in your code, think hard about what you’re doing.

SELECT random() & 1

should return either 0 or 1 on a random basis.  & is binary AND, | is binary OR.

sqlite-users mailing list

Reply via email to