I created a SQLite database where a table 'names' is located. This table stores just a single column called 'name'. Now I tried for test purposes to create a random number within range [0..1] for each record in the table using a SELECT statement like this:
select name, (random() / 9223372036854775807.0 + 1.0) / 2.0 as RNDValue from names; This works fine and the random values are successfully generated within the required range. Now, I tried to select just a subset of records with a random value >= 0.99 for example (using a WHERE condition). The query looks now like: select name, (random() / 9223372036854775807.0 + 1.0) / 2.0 as RNDValue from names where RNDValue >= 0.99; The query returns just a few records, which is fine - but the problem is, that RNDValues less than 0.99 are returned. If I execute the above mentioned query, I get a result like this: Name RNDValue Name1 0.23... Name2 0.521... Name3 0.429... Name4 0.725... Name5 0.149... Is this an error within SQLite or am I just misunderstanding it? Thank you for your suggestions/comments. -- View this message in context: http://www.nabble.com/problem-using-random%28%29-in-queries-tp19203274p19203274.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users