Random row selection but with distinct values for a subset of columns
MariaDB 10.3 supports window functions, so something like this would work:

select * from (
  select 
     t.*, -- all columns
     row_number() -- assign sequential numbers
     over ( -- within a "window"
        partition by k1, k2 -- determined by a unique combination of k1, k2
        order by rand() -- while ordering rows randomly within the partition
     ) as rn -- set the column alias  
  from test t 
) tt 
where rn = 1 -- select only the first row from each "window" (partition)
order by k1, k2, k3


dbfiddle