A
A
Alexander Sinitsyn2018-11-23 08:10:45
1C-Bitrix
Alexander Sinitsyn, 2018-11-23 08:10:45

Is there a ready-made bike for random sampling from a table of users?

Options all fall ten years ago. Maybe there is already something regular?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Gritsuk, 2018-11-23
@a_u_sinitsin

$users = \Bitrix\Main\UserTable::getList([
    "order" => [
        "RAND" => "asc"
    ],
    'runtime' => array(
        new \Bitrix\Main\Entity\ExpressionField('RAND', 'RAND()')
    ),
    "limit" => 10
])->fetchAll();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question