码迷,mamicode.com
首页 >  
搜索关键字:随机数 random threadlocalrandom securerandom    ( 10977个结果
Java语言的基础知识9
第十一章(线程)1、通过Stringname=Thread.currentThread().getName();来获取当前线程的名称。2、多次启动一个线程或者启动一个已经运行的线程是非法的,会抛出IllegalThreadStateException异常对象。Thread.sleep((int)Math.random()*10000);3、java提供了Runnable接口使继承了..
分类:编程语言   时间:2014-08-08 02:11:05    阅读次数:324
Java语言的基础知识9
第十一章(线程)1、通过Stringname=Thread.currentThread().getName();来获取当前线程的名称。2、多次启动一个线程或者启动一个已经运行的线程是非法的,会抛出IllegalThreadStateException异常对象。Thread.sleep((int)Math.random()*10000);3、java提供了Runnable接口使继承了..
分类:编程语言   时间:2014-08-08 02:10:45    阅读次数:284
String,StringBuilder的方法,伪随机Random类
import java.nio.charset.Charset;public class StringDemo { public static void main(String[] args) { byte[]bt={'a','b','c'};// String(b...
分类:其他好文   时间:2014-08-08 01:48:55    阅读次数:270
【LeetCode】Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list. 思路:第一遍正常复制链表,同时用哈希表保存链表中原始节点和新...
分类:其他好文   时间:2014-08-07 23:22:45    阅读次数:280
剪刀石头布
import java.util.Scanner;public class Game { public static void main(String[] args){ int r; r = (int) (Math.random()*2 + 1); S...
分类:其他好文   时间:2014-08-07 18:10:10    阅读次数:159
算法题--rand5产生rand7
由一个随机数产生另外一个随机数,最关键的问题是,如何实现等概率映射?下面是我的rand5产生rand7的实现:主要思路是将rand5映射到rand(5~30),然后抛去多余的几个,将剩下的21个数每三个映射到1~7之间得数。 1 #include 2 #include 3 #include 4...
分类:其他好文   时间:2014-08-07 12:02:39    阅读次数:177
把随机得到的数,个十百位分别相加
import java.util.Random;import javax.swing.JOptionPane;public class Numbers { public static void main(String[] args){ double digit; d...
分类:其他好文   时间:2014-08-06 18:11:31    阅读次数:208
[leetcode]Copy List with Random Pointer
Copy List with Random PointerA linked list is given such that each node contains an additional random pointer which could point to any node in the lis...
分类:其他好文   时间:2014-08-06 17:44:31    阅读次数:225
mongodb学习(六)索引
准备工作: 先插入100万条数据for(i=0;i<=1000000;i++){ db.users.insert({ "i":i, "username":"user"+i, "age":Math.floor(Math.random()...
分类:数据库   时间:2014-08-05 13:54:29    阅读次数:268
HDU 4790 Just Random 数学
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4790 题意:从【a,b】中随机找出一个数字x,从【c,d】中随机找出一个数字y,给出p,m,如果(x+y)%p==m则算成功,问成功的概率是多少。 思路:【a,b】中连续p个数,【c,d】中连续p个数,用这2*p个数进行组合能找到p种的成功组合(具体不证),所以找到【a,b】中p循环的个数x1,【c,...
分类:其他好文   时间:2014-08-05 11:19:29    阅读次数:166
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!