• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP make_seed函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中make_seed函数的典型用法代码示例。如果您正苦于以下问题:PHP make_seed函数的具体用法?PHP make_seed怎么用?PHP make_seed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了make_seed函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: generate

 public function generate($f3)
 {
     require_once '***/libs/htmlpurifier/library/HTMLPurifier.auto.php';
     $purifier = new HTMLPurifier();
     make_seed();
     $models = array('cv2/lm_lstm_epoch50.00_0.5080.t7', 'cv/lm_lstm_epoch46.00_0.7940.t7');
     $rnx = array_rand($models, 1);
     $model = $models[$rnx];
     $seed = round(rand());
     $cmd = 'cd ***/char-rnn && th ***/char-rnn/sample.lua -verbose 0 -temperature 0.8 -gpuid -1 -seed ' . $seed . ' -length 2048 -primetext "<poem><html><head><meta charset=\\"utf-8\\"><style>body{background-color:#000;color:#0c0;}</style></head><body>" /home/drakh/klingon-poetry/' . $model;
     $postVars = array('cmd' => $cmd);
     $options = array('method' => 'POST', 'content' => http_build_query($postVars));
     $r = \Web::instance()->request('http://127.0.0.1:1337', $options);
     $clean_html = $purifier->purify($r['body']);
     $poem = nl2br(trim($clean_html));
     $db_data = array('seed' => $seed, 'model' => $model, 'poem' => $poem);
     $data_to_save = json_encode($db_data, JSON_UNESCAPED_UNICODE);
     $this->model->poem = $data_to_save;
     $this->model->written_date = date('d.m.Y H:i:s');
     $this->model->save();
     $id = $this->model->id_poem;
     $postVars = array('id' => $id);
     $options = array('method' => 'POST', 'content' => http_build_query($postVars));
     $r = \Web::instance()->request('http://127.0.0.1:1338', $options);
     $f3->reroute('/poem/' . $id);
 }
开发者ID:kl-ing-one,项目名称:klingon-poetry.zhadum.space,代码行数:26,代码来源:index.php


示例2: cleanup

/**
* This function will clean up old data in the database that is not 
* needed according to user defined settings.
*
* Deletes entries in the database tables dstore, thatstack, thatstackindex 
* and if set also conversationlog.
*
* @uses make_seed()
*
* @return void        nothing, deletes database entires
*/
function cleanup()
{
    if (RANDOMCHANCECLEAN == -1 || MINUTESTOKEEPDATA == -1) {
        return;
    }
    mt_srand(make_seed());
    $randval = mt_rand(1, RANDOMCHANCECLEAN);
    if ($randval == RANDOMCHANCECLEAN) {
        if (MINUTESTOKEEPDATA != -1) {
            $clean_dstore = "delete from dstore where enteredtime < date_add(now(), interval - " . MINUTESTOKEEPDATA . " minute)";
            $clean_thatstack = "delete from thatstack where enteredtime < date_add(now(), interval - " . MINUTESTOKEEPDATA . " minute)";
            $clean_thatindex = "delete from thatindex where enteredtime < date_add(now(), interval - " . MINUTESTOKEEPDATA . " minute)";
            $selectcode = mysql_query($clean_dstore);
            if ($selectcode) {
            }
            $selectcode = mysql_query($clean_thatstack);
            if ($selectcode) {
            }
            $selectcode = mysql_query($clean_thatindex);
            if ($selectcode) {
            }
        }
        if (MINUTESTOKEEPCHATLOG != -1) {
            $clean_convlog = "delete from conversationlog where enteredtime < date_add(now(), interval - " . MINUTESTOKEEPCHATLOG . " minute) and " . whichbots();
            $selectcode = mysql_query($clean_convlog);
            if ($selectcode) {
            }
        }
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:41,代码来源:util.php


示例3: make_password

function make_password($password_length){
srand(make_seed());
$alfa = "!@123!@4567!@890qwer!@tyuiopa@!sdfghjkl@!zxcvbn@!mQWERTYUIO@!PASDFGH@!JKLZXCVBNM!@";
$token = "";
for($i = 0; $i < $password_length; $i ++) {
  $token .= $alfa[rand(0, strlen($alfa))];
}
return $token;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:9,代码来源:functions.php


示例4: generatePass

function generatePass()
{
    // Generate random password
    srand(make_seed());
    $alfa = "23456789qwertyuiopasdfghjkzxcvbnmQWERTYUIPASDFGHJKLZXCVBNM";
    $password = "";
    for ($i = 0; $i < 7; $i++) {
        $password .= $alfa[rand(0, strlen($alfa) - 1)];
    }
    return $password;
}
开发者ID:hshelton,项目名称:portal,代码行数:11,代码来源:config.php


示例5: gen_rnd_string

 function gen_rnd_string()
 {
     $alphabet = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
     // 1 and I removed
     $myreturn = '';
     mt_srand(make_seed());
     for ($i = 0; $i < $this->chars; ++$i) {
         $myreturn .= $alphabet[mt_rand(0, 31)];
     }
     return $myreturn;
 }
开发者ID:babae,项目名称:etano,代码行数:11,代码来源:sco_captcha.class.php


示例6: promocode_generate

function promocode_generate($ini = 0)
{
    # --------------------------------------------------------
    $p1 = 0;
    $p2 = 0;
    $p3 = 0;
    $c = 0;
    mt_srand(make_seed());
    $c = intval(mt_rand(1000000000, mt_getrandmax())) + 1 . (intval(mt_rand(1000000000, mt_getrandmax())) + 1) . (intval(mt_rand(1000000000, mt_getrandmax())) + 1);
    $p1 = substr($c, 0, 5);
    $p2 = substr($c, 7, 5);
    $p3 = substr($c, 8, 3);
    //     print promocode_dv($p1). $p1. promocode_dv($p1.$p2). $p2. promocode_dv($p2) . $p3 ." ";
    return substr(promocode_dv($p1) . $p1 . promocode_dv($p1 . $p2) . $p2 . promocode_dv($p2) . $p3, 0, 5);
}
开发者ID:sincco,项目名称:sitios-lineales-inova,代码行数:15,代码来源:sms_gift_notification.php


示例7: add

function add()
{
    if (!isset($_POST["message"])) {
        // there is no message , return
        return;
    }
    //write message into a file
    mt_srand(make_seed());
    $randval = mt_rand(1, 50);
    $file = fopen("./message/" . $randval . ".txt", "w");
    fwrite($file, $_POST["message"]);
    fclose($file);
    html_div(100, 10, "#ffffff", 20);
    echo "Success, your message ID is " . $randval;
    html_div_end();
}
开发者ID:sidney0830,项目名称:NS_finalProject,代码行数:16,代码来源:message.php


示例8: randomString

function randomString($len)
{
    function make_seed()
    {
        list($usec, $sec) = explode(' ', microtime());
        return (double) $sec + (double) $usec * 100000;
    }
    srand(make_seed());
    //Der String $possible enth�lt alle Zeichen, die verwendet werden sollen
    $possible = "ABCDEFGHJKLMNPRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789";
    $str = "";
    while (strlen($str) < $len) {
        $str .= substr($possible, rand() % strlen($possible), 1);
    }
    return $str;
}
开发者ID:laiello,项目名称:silvestercms,代码行数:16,代码来源:captcha.php


示例9: getUnID

function getUnID($length)
{
    $toRet = "";
    $symbols = array();
    for ($i = 0; $i < 26; $i++) {
        $symbols[] = chr(97 + $i);
    }
    for ($i = 0; $i < 10; $i++) {
        $symbols[] = chr(48 + $i);
    }
    srand(make_seed());
    for ($i = 0; $i < $length; $i++) {
        $toRet .= $symbols[rand(0, 35)];
    }
    return $toRet;
}
开发者ID:romlg,项目名称:blank-xpage,代码行数:16,代码来源:utilities.php


示例10: gen_new_pwd

function gen_new_pwd()
{
    $password_length = 9;
    function make_seed()
    {
        list($usec, $sec) = explode(' ', microtime());
        return (double) $sec + (double) $usec * 100000;
    }
    srand(make_seed());
    $alfa = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
    $token = "";
    for ($i = 0; $i < $password_length; $i++) {
        $token .= $alfa[rand(0, strlen($alfa) - 1)];
    }
    return $token;
}
开发者ID:picsoung,项目名称:NabzFood,代码行数:16,代码来源:members.php


示例11: check_obval

function check_obval($tree)
{
    global $char;
    $rand = obval_chance($tree);
    mt_srand(make_seed());
    $ch = mt_rand(0, 100);
    if ($ch <= $rand) {
        //обвал
        craft_DelFunc($char['user_id']);
        myquery("DELETE FROM craft_build_rab WHERE user_id=" . $char['user_id'] . "");
        myquery("UPDATE craft_build_stonemason SET klin=0,state=0,user_id=0,end_time=0,chance=0,reserve_time=0,reserve_user_id=0 WHERE id=" . $tree['id'] . "");
        set_craft_delay($char['user_id'], 1);
        echo '<b>Произошел обвал! Работа прекращена!</b><br><br>';
        return 1;
    } else {
        myquery("UPDATE craft_build_stonemason SET chance=chance+5 WHERE id=" . $tree['id'] . "");
    }
    return 0;
}
开发者ID:themiddleearth,项目名称:RPG.SU,代码行数:19,代码来源:stonemason.inc.php


示例12: generate_code

function generate_code($length = 7)
{
    global $wovels, $wovelsnoy, $consonants, $start, $mid, $end, $freqs;
    for ($i = 0; $i < $length; $i++) {
        if ($i == 0) {
            $chars = $wovelsnoy . $consonants;
        } elseif ($i == 1) {
            $chars = wcdispatch($result[$i - 1], $start);
        } elseif (in_array($result[$i - 1], mbStringToArray($wovels)) && in_array($result[$i - 2], mbStringToArray($wovels))) {
            $chars = $consonants;
        } elseif (in_array($result[$i - 1], mbStringToArray($consonants)) && in_array($result[$i - 2], mbStringToArray($consonants))) {
            $chars = checkharmony($result[$i - 1]);
        } elseif ($i == $length - 1) {
            $chars = wcdispatch($result[$i - 1], $end);
        } else {
            $chars = wcdispatch($result[$i - 1], $mid);
        }
        $charset = mbStringToArray($chars);
        $sum = 0;
        foreach ($charset as $char) {
            $sum += $freqs[$char];
        }
        $xfq = array();
        $bsum = 0;
        foreach ($charset as $char) {
            $balanced = $freqs[$char] / $sum;
            $bsum += $balanced;
            $xfq[(string) $bsum] = $char;
        }
        $roll = frand();
        foreach ($xfq as $freq => $letter) {
            if ($roll < $freq) {
                $result[$i] = $letter;
                $roll = 2;
            }
        }
    }
    mt_srand(make_seed());
    $array_mix = preg_split('//', mb_strtoupper(implode("", $result)), -1, PREG_SPLIT_NO_EMPTY);
    return implode("", $array_mix);
}
开发者ID:Juribiyan,项目名称:gsap-l00ps,代码行数:41,代码来源:nrand.php


示例13: make_rand

 public function make_rand()
 {
     function make_seed()
     {
         list($usec, $sec) = explode(' ', microtime());
         return (double) $sec + (double) $usec * 100000;
     }
     $m = M('User');
     $where['username'] = 'rand';
     $arrc = $m->where($where)->find();
     if ($arrc) {
         $data['id'] = $arrc['id'];
         $data['reg_time'] = time();
         srand(make_seed());
         $data['password'] = rand(1000, 9999);
         $succ = $m->save($data);
         if ($succ) {
             $this->redirect('Admin/index');
         }
     } else {
     }
 }
开发者ID:02020,项目名称:paper,代码行数:22,代码来源:OtherAction.class.php


示例14: init_srand

function init_srand($seed = '')
{
    static $wascalled = FALSE;
    if (!$wascalled) {
        $seed = $seed === '' ? make_seed() : $seed;
        srand($seed);
        $wascalled = TRUE;
    }
}
开发者ID:rzs840707,项目名称:webapps_repository,代码行数:9,代码来源:chessutils.php


示例15: sortrandom

 function sortrandom()
 {
     $result = db_execquery('SELECT id from ' . TBL_PLAYLIST_LIST . ' WHERE listid = ' . $this->listid . ' ORDER BY ID ASC');
     srand(make_seed());
     while ($row = db_fetch_row($result)) {
         db_execquery('UPDATE ' . TBL_PLAYLIST_LIST . ' SET seq = ' . getrand() . ' WHERE id = ' . $row[0], true);
     }
     $this->rewriteseq();
 }
开发者ID:skaligotla,项目名称:kplaylist,代码行数:9,代码来源:index.php


示例16: getRand

function getRand($a, $b)
{
    if ($a + 1 == $b) {
        return $a;
    }
    mt_srand(make_seed());
    return mt_rand($a, $b - 1);
}
开发者ID:kktsvetkov,项目名称:1double.com,代码行数:8,代码来源:shared.inc.php


示例17: array

$bg_images = array('ht_freecap_im1.jpg', 'ht_freecap_im2.jpg', 'ht_freecap_im3.jpg', 'ht_freecap_im4.jpg', 'ht_freecap_im5.jpg');
// for non-transparent backgrounds only:
// if 0, merges CAPTCHA with bg
// if 1, write CAPTCHA over bg
$merge_type = 0;
// should we morph the bg? (recommend yes, but takes a little longer to compute)
$morph_bg = true;
// you shouldn't need to edit anything below this, but it's extensively commented if you do want to play
// have fun, and email me with ideas, or improvements to the code (very interested in speed improvements)
// hope this script saves some spam :-)
//////////////////////////////////////////////////////
////// Create Images + initialise a few things
//////////////////////////////////////////////////////
// seed random number generator
// PHP 4.2.0+ doesn't need this, but lower versions will
$seed_func(make_seed());
// how faded should the bg be? (100=totally gone, 0=bright as the day)
// to test how much protection the bg noise gives, take a screenshot of the freeCap image
// and take it into a photo editor. play with contrast and brightness.
// If you can remove most of the bg, then it's not a good enough percentage
switch ($bg_type) {
    case 0:
        break;
    case 1:
    case 2:
        $bg_fade_pct = 65;
        break;
    case 3:
        $bg_fade_pct = 50;
        break;
}
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:31,代码来源:freecap.php


示例18: generateSoal

 function generateSoal()
 {
     $id = $_GET['id'];
     $ujian = $this->models->getData('ujian', 0, "id_ujian = {$id}");
     $this->models->delData('generated_soal', "id_ujian = {$ujian['id_ujian']}");
     $paket = $this->models->getData('paket_soal', 1, "id_ujian = {$id} AND status = 1");
     $getSoal = $this->models->getData('master_soal', 1, "id_soal IN ({$paket[0]['id_soal']})");
     $user = $this->models->getidUser();
     $total = count($user);
     $hasil = 0;
     for ($i = 0; $i < $total; $i++) {
         $soal['id_paket'] = $paket[0]['id_paket'];
         $soal['id_kategori'] = $paket[0]['id_kategori'];
         $soal['paket'] = $paket[0]['paket'];
         $soal['durasi_pengerjaan'] = $ujian['lama_ujian'];
         $exp = explode(",", $paket[0]['id_soal']);
         $soal['soal'] = implode(",", shuffle_assoc($exp));
         for ($j = 0; $j < count($exp); $j++) {
             $option = range(1, 4);
             $tmp[$j] = implode(",", fisherYatesShuffle($option, make_seed($j)));
         }
         $soal['opt'] = serialize($tmp);
         $soal['id_peserta'] = $user[$i]['id_peserta'];
         $soal['id_ujian'] = $ujian['id_ujian'];
         // db($soal);
         $success = $this->models->insert_data($soal, 'generated_soal');
         if ($success) {
             $hasil++;
         }
     }
     if ($hasil != 0) {
         return 1;
     } else {
         return 0;
     }
     db('======= Generate Soal Selesai ========');
 }
开发者ID:TrinataBhayanaka,项目名称:cat.polda,代码行数:37,代码来源:login.php


示例19: retrieveNewMessages


//.........这里部分代码省略.........
                     $na = mysql_fetch_row($selname);
                     $allname = count($na);
                     $user_pos = array_search($original_name, $na);
                     $userName = $na[$allname - 1 - $user_pos];
                 } else {
                     $userName = mysqlresult(myquery("SELECT name FROM game_users WHERE user_id=" . $row['fromm'] . "", $this->mMysqli), 0, 0);
                     $original_name = $userName;
                 }
                 if ($this->maskarad > 0 and $this->maskarad != 4 and $this->maskarad != 6) {
                     //if ($user_id==612 OR $user_id==1 OR $user_id==1016 OR $user_id==3500)
                     //{}
                     //else
                     //{
                     $ar = array();
                     switch ($this->maskarad) {
                         case 1:
                             for ($i = 0; $i < strlen($userName); $i++) {
                                 $ar[] = $userName[$i];
                             }
                             shuffle($ar);
                             break;
                         case 2:
                             for ($i = 0; $i < strlen($userName); $i++) {
                                 $ar[] = "*";
                             }
                             break;
                         case 3:
                             for ($i = 0; $i < strlen($userName); $i++) {
                                 $ar[] = $userName[$i];
                             }
                             $r = mt_rand(2, 3);
                             $kol = strlen($userName) - $r;
                             while ($kol > 0) {
                                 mt_srand(make_seed());
                                 $pos = mt_rand(0, strlen($userName) - 1);
                                 if ($ar[$pos] != "*") {
                                     $ar[$pos] = "*";
                                     $kol--;
                                 }
                             }
                             break;
                         case 5:
                             $strlen = strlen($userName);
                             for ($i = 0; $i < $strlen; $i++) {
                                 $ar[] = $userName[$strlen - ($i + 1)];
                             }
                             break;
                     }
                     $userName = implode($ar);
                     $userName = ucfirst(strtolower($userName));
                     //}
                 }
                 if ($this->maskarad > 0) {
                     if ($user_id == 612 or $user_id == 1 or $user_id == 1016 or $user_id == 3500) {
                         $userName .= " (" . $original_name . ")";
                     }
                 }
                 $userName = iconv("Windows-1251", "UTF-8//IGNORE", $userName);
             } else {
                 $userName = '';
             }
             if ($this->maskarad > 0) {
                 //if ($user_id==612 OR $user_id==1 OR $user_id==1016 OR $user_id==3500)
                 //{}
                 //else
                 //{
开发者ID:themiddleearth,项目名称:RPG.SU,代码行数:67,代码来源:chat.class.php


示例20: init

 /**
  * Init the Generator script:
  * - init the SQL profiler
  * - init the random generator
  * - setup the different possible values for parameters such as 'resolution',
  * 		'color', 'hour', 'minute', etc.
  * - load from DataFiles and setup values for the other parameters such as UserAgent, Referers, AcceptedLanguages, etc.
  *  @see /misc/generateVisitsData/
  * 
  * @return void
  */
 public function init()
 {
     Piwik::createLogObject();
     $this->initProfiler();
     /*
      * Init the random number generator 
      */
     function make_seed()
     {
         list($usec, $sec) = explode(' ', microtime());
         return (double) $sec + (double) $usec * 100000;
     }
     mt_srand(make_seed());
     /*
      * Sets values for: resolutions, colors, idSite, times
      */
     $common = array('res' => array('1289x800', '1024x768', '800x600', '564x644', '200x100', '50x2000'), 'col' => array(24, 32, 16), 'idsite' => $this->idSite, 'h' => range(0, 23), 'm' => range(0, 59), 's' => range(0, 59));
     foreach ($common as $label => $values) {
         $this->addParam($label, $values);
     }
     /*
      * Sets values for: outlinks, downloads, campaigns
      */
     // we get the name of the Download/outlink variables
     $downloadOrOutlink = array(Piwik_Tracker_Config::getInstance()->Tracker['download_url_var_name'], Piwik_Tracker_Config::getInstance()->Tracker['outlink_url_var_name']);
     // we have a 20% chance to add a download or outlink variable to the URL
     $this->addParam('piwik_downloadOrOutlink', $downloadOrOutlink);
     $this->addParam('piwik_downloadOrOutlink', array_fill(0, 8, ''));
     // we get the variables name for the campaign parameters
     $campaigns = array(Piwik_Tracker_Config::getInstance()->Tracker['campaign_var_name']);
     // we generate a campaign in the URL in 3/18 % of the generated URls
     $this->addParam('piwik_vars_campaign', $campaigns);
     $this->addParam('piwik_vars_campaign', array_fill(0, 15, ''));
     /*
      * Sets values for: Referers, user agents, accepted languages
      */
     // we load some real referers to be used by the generator
     $referers = array();
     require_once PIWIK_INCLUDE_PATH . "/misc/generateVisitsData/Referers.php";
     $this->addParam('urlref', $referers);
     // and we add 2000 empty referers so that some visitors don't come using a referer (direct entry)
     $this->addParam('urlref', array_fill(0, 2000, ''));
     // load some user agent and accept language
     $userAgent = $acceptLanguages = array();
     require_once PIWIK_INCLUDE_PATH . "/misc/generateVisitsData/UserAgent.php";
     require_once PIWIK_INCLUDE_PATH . "/misc/generateVisitsData/AcceptLanguage.php";
     $this->userAgents = $userAgent;
     $this->acceptLanguage = $acceptLanguages;
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:60,代码来源:Generator.php



注:本文中的make_seed函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP make_select函数代码示例发布时间:2022-05-15
下一篇:
PHP make_score_random_insert_update函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap