In SQLite
The
random()function returns a pseudo-random integer between -9223372036854775808 and +9223372036854775807.
You can get an random with maximum value n with Select random() % n ;
But that still generates negative numbers. How can I generate only positive random numbers in SQLite ?
Use the
ABS()(absolute value) function:Note that: