代码改变世界

阅读排行榜

研究微信红包分配算法之Golang版

2020-02-17 10:33 by 斌哥tobin, 2555 阅读, 收藏,
摘要: 今天来看一下红包的分配,参考几年前流传的微信红包分配算法,今天用Golang实现一版,并测试验证结果。 微信红包的随机算法是怎样实现的?https://www.zhihu.com/question/22625187 红包核心算法 每次拆红包,额度范围在【0.01 ~ 剩余平均值 2】之间,这是很妙的 阅读全文

linux top命令查看内存及多核CPU的使用讲述 [转]

2012-06-27 17:51 by 斌哥tobin, 2266 阅读, 收藏,
摘要: FROM: http://www.lvtao.net/html/2174.html查看多核CPU命令mpstat-PALL和sar-PALL说明:sar-PALL>aaa.txt重定向输出内容到文件aaa.txttop命令经常用来监控linux的系统状况,比如cpu、内存的使用,程序员基本都知道这个命令,但比较奇怪的是能用好它的人却很少,例如top监控视图中内存数值的含义就有不少的曲解。本文通过一个运行中的WEB服务器的top监控截图,讲述top视图中的各种数据的含义,还包括视图中各进程(任务)的字段的排序。top进入视图【top视图01】是刚进入top的基本视图,我们来结合这个视图讲解 阅读全文

一个小玩意 PHP实现微信红包金额拆分试玩

2014-01-29 17:56 by 斌哥tobin, 2256 阅读, 收藏,
摘要: bonus_num = 10; $this->bonus_money = 200; $this->money_single_max = 60; } private function randomFloat($min = 0, $max = 1) { $mt_rand = mt_rand(); $mt_getrandmax = mt_getrandmax(); echo 'mt_rand=' . $mt_rand . ', mt_getrandmax=' . $mt_getrandmax . ''; ... 阅读全文

PHP使用OPENSSL RSA加密解密数据

2016-01-14 16:49 by 斌哥tobin, 2177 阅读, 收藏,
摘要: 加密数据有很多种方法,今天我们来看一下OPENSSL RSA的加密办法。1、首先得安装php的openssl扩展php -m | grep openssl执行以上命令,确保已经安装了openssl php扩展2、接下来要安装Linux opensslyum -y install openssl-de... 阅读全文

PHP去除全角空格与空白字符

2012-08-22 01:54 by 斌哥tobin, 2090 阅读, 收藏,
摘要: /** * 空白字符替换 * @param string $content 内容 * @param string $len 截取长度 * @param string $encode 编码 * @return string */function mbStrReplace($content,$len=0,$encode='utf-8',$htmltags=true) { $str = trim($content); if($htmltags) $str = strip_tags($str); $str = preg_replace('/[\n|\r|\t]+/', 阅读全文
上一页 1 2 3 4 5 6 7 8 ··· 17 下一页