I have query with 2 conditions which return 1 record every request 1by1 as inserted in space
box.space.extensions.index.secondary:select(
{city, 0},
{limit=1}
)
Sample:
{1}
{2}
{3}
I need to get random record every request. Sample:
{3}
{1}
{2}
According to tarantool API,
selectreturns array of tuples, so that's a regular Lua table you can manipulate by yourself. If you want to randomize the content in the request you needtable.Shuffle. If you want to get one random item from the request, you can usetbl[math.random(#tbl)].Here is example of
table.Shufflecode: