<?php

namespace console\controllers;

use Yii;
use yii\console\Controller;
use yii\helpers\Console;

/**
 * Description of RbacsetController
 *
 * @author blobt
 */
class TestController extends Controller {

    public function actionIndex() {
        //Yii::$aa->security->generateRandomString(8);
        $security = Yii::createObject("yii\base\Security");
        $n = 0;
        for ($i = 1; $i < 1000; $i++) {
            //$key = $security->generateRandomString(8);
            $key = rand(10000000, 99999999);
            //$key = strtolower($key);
            //$key = str_replace(['_', '-'], 'a', $key);
            $ret[$key] += 1;
        }

        $this->stdout("duplicate data:\n", Console::FG_RED);
        foreach ($ret as $k => $v) {
            if ($v > 1) {
                echo "$k $v\n";
            }
        }
    }
}