c********w 发帖数: 2438 | 1 第二个while循环
copy random的时候
如果原random是null怎么办
不就run time error了
所以要处理
if(pointer.random!=null) |
|
s********u 发帖数: 1109 | 2 感觉你们的想法都太tricky了,我想不到。我就是存两个map,一个新节点对应到旧节
点,另一个旧节点对应到新节点。。。
class Solution {
public:
RandomListNode *copyRandomList(RandomListNode *head) {
unordered_map< RandomListNode *, RandomListNode *> oldNew;
unordered_map< RandomListNode *, RandomListNode *> newOld;
RandomListNode *runner = head;
RandomListNode *dummy = new RandomListNode(0);
RandomListNode *curr = dummy;
while(runner){
curr->next = new R... 阅读全帖 |
|
p****U 发帖数: 109 | 3 RandomListNode *copyRandomList(RandomListNode *head) {
// Note: The Solution object is instantiated only once and is reused by
each test case.
//first parse
if(!head)
return NULL;
RandomListNode *cur=head;
while(cur){
RandomListNode *tmp=cur->next;
cur->next=new RandomListNode(cur->label);
cur=cur->next;
cur->next=tmp;
cur=cur->next;
}
//second parse
cur=head;
RandomListNode *copy;
while(cur){
copy=cu... 阅读全帖 |
|
b********y 发帖数: 5829 | 4 Modern financial economics is built on a foundation of sands by assuming
stock market follows random process.
Key point: if stock market price really follows a random process, you can
never make a prediction at certain point of time, the simplest version: a
random walk so up or down is always 50:50, so stock market is a casino, and
if you gamble on the market you will be wiped out eventually.That's what
financial economics and efficient market hypothesis tell you, and they are
very wrong.
The cr |
|
N****g 发帖数: 2829 | 5 问题是在摆上移民官桌子之前,那些文件都是已经按PD排好了的,否则如果没有排好的
话,每当一个月的排期一开始实行,USCIS也不会立即就一刀切到排期那一天,把早于
那一天的全部抽出来了。
接下去的问题是,既然在摆上移民官桌子之前,那些文件都是已经按PD排好了,为什么
给移民官的时候要再打乱?
问题1.假设现在有1万份EB2 current待批,移民官有50人,那么移民局是在第一天就把
1万份发下去,平均给每个移民官200份(情况1),还是先取出这1万份中的一部分,比
如前2500份,平均给每个移民官50份(情况2)。我认为情况2比情况1更合理。
问题2.如果是情况1,平均分给移民官每人200份的时候,这200份是从1万份中randomly
抽取200份的,然后到了每个移民官手里再排序(Sub情况1),还是说每个移民官拿到
的200份都是连号的,都是日期连续的人(Sub情况2),还是说1万份中randomly抽取
200份,到了移民官手里也不再排序,totally random(Sub情况3)。这里Sub情况1好
于Sub情况2好于Sub情况3. |
|
o***e 发帖数: 65 | 6 【 以下文字转载自 EB23 讨论区 】
发信人: lush (lush), 信区: EB23
标 题: 大家帮忙签一下这个加速PERM Random Audit的Petition
发信站: BBS 未名空间站 (Sun Apr 27 17:36:26 2014, 美东)
Random Audit本身就不太合理,真正应该被Audit的,是那些批量作假的阿三公司,但
是很多中国申请者也受拖累, PERM本身没有问题, 却被Random Audit。
所以不管PERM批了没批的,都请帮忙sign一下,帮助中国人。
http://www.change.org/petitions/dr-william-l-carlson-dol-please
It will be sent to:
Dr. William L. Carlson
Administrator, Office of Foreign Labor Certification
Department of Labor
Mr. Thomas Perez
The United States Secretary of Labor
Senator... 阅读全帖 |
|
l**h 发帖数: 893 | 7 【 以下文字转载自 EB23 讨论区 】
发信人: lush (lush), 信区: EB23
标 题: 大家帮忙签一下这个加速PERM Random Audit的Petition
发信站: BBS 未名空间站 (Sun Apr 27 17:36:26 2014, 美东)
Random Audit本身就不太合理,真正应该被Audit的,是那些批量作假的阿三公司,但
是很多中国申请者也受拖累, PERM本身没有问题, 却被Random Audit。
所以不管PERM批了没批的,都请帮忙sign一下,帮助中国人。
http://www.change.org/petitions/dr-william-l-carlson-dol-please
It will be sent to:
Dr. William L. Carlson
Administrator, Office of Foreign Labor Certification
Department of Labor
Mr. Thomas Perez
The United States Secretary of Labor
Senator... 阅读全帖 |
|
g****n 发帖数: 7494 | 8 我发现主要的地图场景,不是random的
但是小地图是random的,我用巫师打了两遍,很多小地窖,小墓地都是random的
比如打boss前,找皇冠的那三个古墓,我两次打完全不一样,情节也不一样 |
|
c*****t 发帖数: 1879 | 9 俺有一 table (id bigint, char* data). 其中 id 是 unique 但不一定
连续的数字。
问,如何从该 table 里面挑 N 个 row (random order,有可能重复)?
比如 table
1 a
9 b
7 c
8 d
如果里面挑 3 个,可以得到 abc, aac 等。postgresql 里面有
select * from table order by random(),不过那个好像是
random w/o replacement ,不是俺要的。
thx |
|
a*****n 发帖数: 5158 | 10 i want to generate 100 random numbers between 0-1,
why the following program only generate 100 SAME numbers?
#include
#include
float random(int lowest, int highest)
//return a random number between highest and lowest
{
srand(time(NULL));
float result=0.0;
int range=(highest-lowest)+1;
if(highest<=lowest)
return 0.0;
else {
result = float(lowest)+range*rand()/(RAND_MAX + 1.0);
return result;
}
|
|
t****t 发帖数: 6806 | 11 /dev/random is different -- /dev/random is RNG, while libc rand() or
whatever function from software is PRNG. "Real" rng must have OS support (
which /dev/random do).
most libc rand() is linear congruential generator. it's easy to implement
and fast.
however it has some severe problem, and is of low quality. |
|
t****t 发帖数: 6806 | 12 then rand() is indeed a function of time(), which could be random, or could
be totally not random.
(pseudo) random generator is not a trivial topic. the quality of PRNG varies
a LOT. if your program need to use a lot of PRN (e.g. more than 2^16),
usually you have to pick a reasonable generator, instead of blindly using
the rand() comes with libc. |
|
B****n 发帖数: 1523 | 13 需要用到头文件#include ,可是这个说是latest revision of the C++
standard 2011.
我的compiler太老了,不support,说Unable to open include file 'random'
我该怎么做?到哪儿能download random.cpp/h,copy到我compiler的include目录,
就能support吗?还是要怎样?万分感谢! |
|
d********r 发帖数: 303 | 14 HI, all,
I eventually find a second paper for our random journal club. I first
randomly pick a letter from S, N, C and P, representing Science, Nature, Cell
and PNAS. I got C. Then I choose a month. It is 04/2003. There are two issues
in that month. I use a coin to pick one. It is the 04/18 issue. I go to its
preview. There are four of them. I randomly choose one. It is the second one,
named as: Global Phage Diversity (Cell, Vol 113, 141, 18 April 2003).
Here is the citation and summary of that |
|
l**********1 发帖数: 5204 | 15 OMG
LZ used degenerated primer for cDNA single strand synthesis
R U Seriously? an amateur molecular biologist LZ?
Please go to
//www.protocol-
online.org/prot/Molecular_Biology/RNA/Reverse_Transcription__RT____cDNA_Synthesis/index.html
RT reaction is also called first strand cDNA synthesis. Three types of primers can be used for RT reaction:
oligo (dT) primers, random (hexamer) primers and gene specific primers with each having its pros and cons.
or
/media.affymetrix.com/support/technical/usb... 阅读全帖 |
|
S***k 发帖数: 158 | 16 这问题我自己在网上查了好长时间了,自己也做过一些尝试性的实验,但是结果都不是
很好。所以想在这里请教一下大家,希望有经验的前辈不令赐教。
我现在的目标是合成acrylic acid和acrylamide的copolymer,目标是合成(PAA-co-
PAM)random copolymer而不是block copolymer。聚合的手段是自由基聚合(living
radical polymerization:RAFT)。
我查到的文献和wiki都说,如果直接在一开始就把两种monomer放到一个烧瓶,同时开
始反应,那么产物很有可能是block copolymer。可是我的monomer的propagation
constant差别在一个数量级以内,那么如果一开始就放在一起的话,是不是也会倾向于
生成block copolymer呢?
如果这样做确实会导致生成block copolymer的话,那么我应该怎么做才能生成random
copolymer呢?
另外,检测copolymer是block还是random的方法,除了测Tg,做C-NMR以外,还有什么
比较有效的方法么?
在这里... 阅读全帖 |
|
w**d 发帖数: 2334 | 17 【 以下文字转载自 Mathematics 讨论区 】
【 原文由 wind 所发表 】
Here comes the question: Given the joint PDF of 2 RVs X and Y, how to generate
the random numbers from that PDF?
If X & Y are independent, and the CDF of X, Y can be easily inverted,
the problem is trivial.
So my questions are :
1)If X, Y are independent, but impossible to compute the inverse function of
the CDF of X or Y, how to generate the random numbers?
2)If X, Y are not independent, how to generate the random numbers?
I could n |
|
l*******G 发帖数: 1191 | 18 sigh,,you should use your own random number generator,, otherwise, your code
is not portable coz it depends on compiler.. Here are two codes copied from
ROMS model:
SUBROUTINE nrng (ix, a, n, ierr)
!
!=======================================================================
! !
! Gaussian random-number generator from the NSWC Library. It calls !
! the NSWC uniform random-number generator, URNG. !
! |
|
r****y 发帖数: 1437 | 19 【 以下文字转载自 Mathematics 讨论区 】
发信人: rossby (五十岚已夜), 信区: Mathematics
标 题: a question about random number generator
发信站: BBS 未名空间站 (Thu Feb 7 11:28:25 2008), 转信
e.g., given a covariance matrix
cov = [ 1 0.02
0.02 1]
how to generate two random number series that have such covariance?
let's make it more specific, two random numbers both follow normal
distribution.
I guess there must be an algorithm invented already by someone for
such thing.
|
|
|
S***k 发帖数: 158 | 21 这问题我自己在网上查了好长时间了,自己也做过一些尝试性的实验,但是结果都不是
很好。所以想在这里请教一下大家,希望有经验的前辈不令赐教。
我现在的目标是合成acrylic acid和acrylamide的copolymer,目标是合成(PAA-co-
PAM)random copolymer而不是block copolymer。聚合的手段是自由基聚合(living
radical polymerization:RAFT)。
我查到的文献和wiki都说,如果直接在一开始就把两种monomer放到一个烧瓶,同时开
始反应,那么产物很有可能是block copolymer。可是我的monomer的propagation
constant差别在一个数量级以内,那么如果一开始就放在一起的话,是不是也会倾向于
生成block copolymer呢?
如果这样做确实会导致生成block copolymer的话,那么我应该怎么做才能生成random
copolymer呢?
另外,检测copolymer是block还是random的方法,除了测Tg,做C-NMR以外,还有什么
比较有效的方法么?
在这里... 阅读全帖 |
|
a****t 发帖数: 720 | 22 generally, pseudo-random number generating is based on random walks on
certain abelian finite groups. most classical example is following,
computing recursively X_{n+1}=aX_n+b mod(p) for some large prime p. if a=1,
b=+1,-1,0 with prob 1/3 each, with help of discrete fourier transformation,
you need roughly p^2 steps to get randomness.
more detail you can refer persi diaconis's series papers in late 1980's.
also he has a very nice book, group representations in probability and
statistics.
another |
|
L******9 发帖数: 78 | 23 Mehta M.L. - Random matrices - AP 1991 2ed
COLL 45 - Katz, Sarnak - Random Matrices, Frobenius Eigenvalues, and
Monodromy
An Introduction to Random Matrices Greg W. Anderson |
|
r**a 发帖数: 536 | 24 What do you want to know? I do not think this kind of concepts are very
helpful for understanding the financial models. The random field stuff is
being used in string theory daily. It is nothing but a random map from a
manifold to another manifold. In string theory, you need to "sum" these maps
together to get the partition function.
I roughly browsed the book you mentioned. I do not think the random field
theory is necessary introduced. I personally suggest to try to understand
the essential th... 阅读全帖 |
|
g***o 发帖数: 230 | 25
There are 2 kinds of randomness. The first is due to the lack of enough
information, e.g, the uncertainty we discussed in A.I. The second is
the intrinsic randomness,e.g., what we met in QM. Actually there is a third,
which is kind of between the first two, (quasi-)randomness caused by chaotic
behavior of nonlinear system. One famous argument in chaos theory is, no
matter
how precise you know the system state ( how much information you have ), as
long as you don't know the EXACT state, your pr |
|
d*******1 发帖数: 293 | 26 假设两个block size, 2 和 4, 做randomization assignment, 首先是生成一个2和4
的random系列, 这个很容易, 用 rununi(seed) with same seed 就行。 假设是
224442244244224
下一步系列内每一个block size生成一个对应的random的permutation of block size.
我这儿的问题是, 如果用rununi(seed)的话,我是不是每一个都要用不同的seed,为
了保证每一个permutation都有相同的机会。(for example, for first, 2, use
rununi(10), second, 2, use rununi(20), third, 4, use rununi(30) ----- |
|
o******6 发帖数: 538 | 27 ☆─────────────────────────────────────☆
davfox121 (davfox) 于 (Wed Mar 4 09:31:30 2009) 提到:
假设两个block size, 2 和 4, 做randomization assignment, 首先是生成一个2和4
的random系列, 这个很容易, 用 rununi(seed) with same seed 就行。 假设是
224442244244224
下一步系列内每一个block size生成一个对应的random的permutation of block size.
我这儿的问题是, 如果用rununi(seed)的话,我是不是每一个都要用不同的seed,为
了保证每一个permutation都有相同的机会。(for example, for first, 2, use
rununi(10), second, 2, use rununi(20), third, 4, use rununi(30) ----- |
|
a***r 发帖数: 420 | 28 我觉得你想说的是sample是不是randomly recruited的?
如果是这样的话,我觉得算是
前提是数据库采样的recruitment是non-biased的,在比如性别,种族,等等你想“
randomize”的因素上分布是“random”的
然后仅仅根据年龄筛选“老年人” |
|
s**********7 发帖数: 24 | 29 最近在做一个project,有一个数据,是一群人的考试数据,有 ID, binary
response 0/1, 0 是错误回答,1是正确回答, 以及age, gender, years of
education 这样的variable.
Psychology/measurement 里有IRT model, 所以要求用这一堆数据和Rasch
Model (one parameter logistic Model)来估计item difficulty parameter. 这个比
较简单,用HLM,item 是level1, 人的能力是 level 2.item nested within 每个人,
PROC GLIMMIX 就得出来了。
还有一个要求是用 SAS PROC GLIMMIX,用这个binary response 数据和age
, gender, yearsofeducation variable 来model 人的能力. 我有一点没想通,人的能
力是latent trait,在HLM (Multilevel mixed-m... 阅读全帖 |
|
v*******a 发帖数: 1193 | 30 good topic.
Let me ask one more question
Is random effect = random intercept?
然后我来讲个我的理解:
eg:减肥药,减肥有没有有效,那个就是fixed effect
但是每个人基础体重不一样,胖的减的估计就多,瘦的减的少,
那就是 random effect
这样解释对吗? |
|
s****e 发帖数: 1180 | 31 想要描述不同种类的random variables之间的correlation有可能吗?如random
variable 1是poisson分布的,random variable 2是binomial分布的,他们之间的
correlation有可能用某一statistic描述吗?有没有相关的reference?thank you! |
|
f*****k 发帖数: 110 | 32 In the book for SAS adv prep is an example on Creating a Random Sample
without Replacement on P459. Who can help me to understand the logic behind
the method. Or any other better methods? Thanks a lot.
The example and codes are posted below:
Example
You can use a DO WHILE loop to avoid replacement as you create your random
sample. In the following example
# Sasuser.Revenue is the original data set.
# sampsize is the number of observations to read into the sample.
# Work.Rsubset is the data set t... 阅读全帖 |
|
D******n 发帖数: 2836 | 33 Ya, everything is random. We usually think X is accurate and error of y
comes from measurement error of Y or unaccounted factors. Of course
there
are always errors when measuring X. But as you say, error of measuring X
can
be thought to be transferred to e.
But actually if you think about how you are going to use this model, you
don
't need to bother to have concern on X. Yes there are measurement error
on X
but it is likely when you use this model , you will still have the
measurement error on ... 阅读全帖 |
|
O*****y 发帖数: 222 | 34 可能我没有把问题描述清楚.
我知道在R里 sample(1:n, m, replace=FALSE) 可以生成一个random vector, 而重复
多次之后可以生成 a collection of random vectors.
我的问题是我现在有 a huge collection of vectors (注: 这些vectors并不是用上面
的方式得到的, 他们彼此之间可能会有些关联). 我想要从这些vectors中选一些出来组
成一个类似 a collection of random vectors. |
|
D******n 发帖数: 2836 | 35 More information is needed.
1) are u trying to prove/disaprove that the number 500 is not random or the
fact that those 500 specific genes are chosen is not random?
2) how many genes are there?
if u are just concerned about the numbers and there is not specific prior
for each gene, maybe you are asking the following question:
there are totally n genes, 3000 genes are randomly chosen to be in group A
and 4000 in group B, whats the probably that group A and B has a overlap of
500 or higher? |
|
A*******s 发帖数: 3942 | 36 有时候用random effect是因为特殊的目的,
而不一定是因为data本身的性质。
比如说你也提到了level太多,
这时候random effect起的是shrinkage的作用,
或者说是减少model df的。
或者说需要model correlation
可以用random effect也可以用GEE-type的办法
或者说是需要用到Empirical Bayes Estimates的...
还有用来model unconstant variance的...
这个单子能列很长吧,呵呵...
a |
|
c****t 发帖数: 19049 | 37 这都什么乱七八糟的。
fixed effects就是说你在严格控制的实验条件下观测了一批数据,而且你认为它们都
是符合某种条件的random variables; random effects就是说你测数据时没法严格控制
,所以观测结果受某个或某些没控制的random variable(s)影响了。最常见的情况,比
如你的数据不是控制实验下得来的,所以有很多dependency,或者比如你观测的东东有
自然grouping,你没法直接观测也没法控制 |
|
c****u 发帖数: 243 | 38 "就是说你测数据时没法严格控制,所以观测结果受某个或某些没控制的random
variable(s)影响了"
It is called measurement error, not random effect.
when beta (unknown) is not fixed for every observation,
e.g. following some distribution, it is called the random effect. |
|
s*r 发帖数: 2757 | 39 其实教科书上说到fixed random 都是在anova里面引入的,而anova的经典表示方法是y
=u+b+e. y=u+Bx+e是general linear model的写法,这里x就是dummy variable 的
design matrix了。
在anova里理解fix/random effect要容易. b是random effect with p level的话,对
应的B, 在effect coding下,就是一个p-1的vector. 这个vector的每一个element都是
从一个normal distribution里面出来;x总是fixed,因为它代表每个subject的effect
属于哪个level. |
|
A*******s 发帖数: 3942 | 40 什么时候应该用random effect,什么时候random effect estimate趋近fixed effect
estimate,如何从bias variance trade-off的角度来理解random vs. fixed...这都是
我常问的面试问题。lz搞清楚这些问题就有答案了... |
|
n*********a 发帖数: 1956 | 41 http://en.wikipedia.org/wiki/Las_Vegas_algorithm
Las Vegas algorithm is a randomized algorithm that always gives correct
results.
My comments: All efficient (polynomial-time) Las Vegas algorithms are in the
P-class. For NP-complete problems, a Las Vegas algorithm will solve all NP
-complete problems in polynomial-time if it can solve one such problem in
polynomial-time. This looks like a dream, in particular the Chinese dream,
i.e., to use a centralized controlled efficient means (instantiated... 阅读全帖 |
|
L*******r 发帖数: 119 | 42 我也是闲的蛋疼。
我猜他是想问random graph相关的问题。如果换一种看得懂的表述方式,他的问题可能
是这样的:现在图里有K+1个点,然后我不断往里添加点,每次添加一个点,就随机的
和已有的K个点相连。然后不断的往里加,问当加入无穷多个点之后,任意两点联通的
概率是多大。
然后估计有人用渗透理论解决了这个问题。如果搜 percolation theory random graph
,大约能有些论文讲这个问题。比如这个:
http://math.uchicago.edu/~shmuel/Network-course-readings/van%20
不过反正我是没看懂。有谁看懂了的上来讲讲吧。 |
|
t***u 发帖数: 20182 | 43 •Research Article
Reverse-engineering censorship in China: Randomized experimentation and
participant observation
Gary King1,*,
Jennifer Pan1,
Margaret E. Roberts2
+
Author Affiliations
1Institute for Quantitative Social Science, Harvard University, Cambridge,
MA 02138, USA.
2Department of Political Science, University of California, San Diego, La
Jolla, CA 92093, USA.
↵*Corresponding author. E-mail: [email protected]
(function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagNam... 阅读全帖 |
|
a******g 发帖数: 13519 | 44 作为资深码工,我可以告诉你们,没有truly random, 只有Pseudo random。所以,随
机都是假的。如果打官司,法官问起,你们就告诉法官是我说的。 |
|
l*k 发帖数: 624 | 45 what is discover random #?
how to get the random #? |
|
w****i 发帖数: 2316 | 46 【 以下文字转载自 Chicago 讨论区 】
发信人: xlyytchy (农夫), 信区: Chicago
标 题: 大家出门小心点, chicago全城黑帮在搞 random kill
发信站: BBS 未名空间站 (Thu Jun 2 12:02:21 2011, 美东)
之前警方最新派驻近400人的特别分队,准备治理chicago黑帮问题。 黑帮立马做出反
应。
现在枪击不是原来的黑帮内部仇杀, 现在是random kill!
也不像原来只是englewood 之类的 jungle里面打杀, 而是到处杀
阿米驼佛!
阿米驼佛! |
|
h***g 发帖数: 337 | 47 ☆─────────────────────────────────────☆
Tosca (Vissi+d'amore) 于 (Wed Nov 1 18:58:09 2006) 提到:
Given a function that generates 1-5 randomly, how to generate 1-7 randomly?
愚钝得很。谁能给点儿提示?
下星期有个电话interview, 没准就被问了。
谢谢了!
☆─────────────────────────────────────☆
madcowdd (madcow) 于 (Wed Nov 1 19:03:01 2006) 提到:
((g-1)/4)*6+1
☆─────────────────────────────────────☆
squash (日三醒吾身) 于 (Wed Nov 1 19:05:36 2006) 提到:
没想出什么好办法
取两次,25种组合,21种有效,4种无效。
有效组合分7组,无效组合重新取两数?
☆──────────────────────── |
|
|
m*****f 发帖数: 1243 | 49 What is the probablity to get a 7 using this function? Is it 1/7? or equal
to any other number?
seems not..
random |
|
s*********t 发帖数: 1663 | 50 如果random(n)是0-n的话好像没错呀,是1/8 |
|