<?php require_once __DIR__ . "/random_users.php";

try {
    $pdo->beginTransaction();

    foreach ($random_users as $rand_user) {
        User::createUser(
            $rand_user['username'],
            $rand_user['password'],
            $rand_user['age'],
            $rand_user['name'],
            $rand_user['email'],
            $rand_user['level']
        );
    }

    $pdo->commit();
}
catch(Exception $ex) {
    $pdo->rollBack();
    print($ex->getMessage());
}