If you have a large database you often want to sample rows from it. For many uses the sampling should be randomly done. A reasonably fast way to do this completely in SQL is the following: SELECT * FROM my_table WHERE rowid in (SELECT abs(random()) % N FROM my_table LIMIT k); Where N is the… Read More Sample randomly from an sqlite database
I’ve made computers do tricks in both C/C++ and Python for many years now. For the past few years I’ve written exclusively in Python for both work and play. I recently went back to a personal project to rewrite it in C++ and, for the first time in my life, thought, “Why would I ever… Read More Why would I ever write in C?