码迷,mamicode.com
首页 >  
搜索关键字:random walk    ( 8169个结果)
生成不重复的32为随机码
public static void main(String[] args) throws ParseException { //random(2); UUID.randomUUID().toString().replaceAll("-", "~~"); System.out.print...
分类:其他好文   时间:2014-10-09 13:58:03    阅读次数:176
Leetcode - CopyWithRandomList
Algorithm: Iterate copy the original list first. For the random pointer, copy its original value(address) first. And during the iterate, use a map to store each node's original address and the corresp...
分类:其他好文   时间:2014-10-09 02:52:27    阅读次数:187
javascript生成n至m的随机整数
摘要: 本文讲解如何使用js生成n到m间的随机数字,主要目的是为后期的js生成验证码做准备。 Math.random()函数返回0和1之间的伪随机数,可能为0,但总是小于1,[0,1)生成n-m,包含n但不包含m的整数:第一步算出 m-n的值,假设等于w第二步Math.random()*w第三步.....
分类:编程语言   时间:2014-10-09 00:53:57    阅读次数:210
经典排序之插入排序
插入排序的思想很简单,就是每向有序序列中插入一个数,就把这个数依次与其他数比较,逐次替换。 下面是代码public class InsertSort { public void insertSort(int a[]){ int length=a.length; int i; int keyword; for(int j=1;j<length;j...
分类:其他好文   时间:2014-10-08 10:31:05    阅读次数:161
rand(5) -> rand(7)
int rand7() //random number from 1 - 7{ int r = 0; do { int a = rand(5) - 1; //uniformly at random from 0 to 4 int b = rand(5) - ...
分类:其他好文   时间:2014-10-07 08:16:23    阅读次数:226
cookbook 10.1生成随机密码
任务:随机地创造出新密码。比如,有时需要给新的用户账号分配新的密码。解决方案:from random import choiceimport stringdef GenPasswd(length=8,chars=string.letters+string.digits): return ''....
分类:其他好文   时间:2014-10-05 22:38:49    阅读次数:122
2014 ACM/ICPC 鞍山赛区网络赛(清华命题)
为迎接10月17号清华命题的鞍山现场赛杭电上的题目Biconnected(hdu4997)Rotate(hdu4998)Overt(hdu4999)Clone(hdu5000)Walk(hdu5001)LianLianKanRescueSpy's WorkColor the TreeThe Ghos...
分类:其他好文   时间:2014-10-05 21:29:49    阅读次数:221
javascript获取随机颜色
方案一:function getRandomColor(){ varstr="0123456789abcdef"; vart="#"; for(j=0;j>0).toString(16)).slice(-6); //return '#'+('00000'+(Math.random()*...
分类:编程语言   时间:2014-10-05 20:52:38    阅读次数:189
经典排序之快速排序
快速排序堪称最经典的排序,思想是选一个基准值,一般选第一个。然后所有的值与基准值比较,大的位置不变, 小的位置与第一个大的位置互换,就这样进行第一轮排序,然后对于基准值二边的再进行排序,依次类推,直到为剩一个。 下面是快排的代码: public class QuickSort { public void quickSort(int a[],int start,int end){...
分类:其他好文   时间:2014-10-05 17:36:28    阅读次数:142
Java中的随机数生成器:Random,ThreadLocalRandom,SecureRandom(转)
文中的Random即:java.util.Random,ThreadLocalRandom 即:java.util.concurrent.ThreadLocalRandomSecureRandom即:java.security.SecureRandomQ:Random是不是线程安全的?A:Rando...
分类:编程语言   时间:2014-10-05 01:40:17    阅读次数:143
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!