我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
& {3 z8 b) S5 R2 ^9 f, U- R* wimport swarm.Globals;
) \" S, v5 p2 N/ A0 |. y3 T
+ a% y& ?( Q4 Y" Y" U' c3 r) Xpublic class test {
, I ~& H# c1 Z! o& f( u. Y /**1 W2 ^, w8 d- e4 S! N4 A7 j
* @param args8 y4 N/ U% p2 A" i. T
*// @ a5 L4 }" j7 H% [" f
public static void main(String[] args) {% V+ `' R- { S& x r
( b3 I2 {) e% j; g0 Q5 q* y6 F
int y=(int)(10*Math.random());
0 H. Z; o9 L* w; I( _2 k0 m$ n& @ System.out.println("result is "+y);
: Z# H) @3 H" g
0 W3 U- {0 w2 {" R double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);
" `& x9 u6 `8 t: p& e; i( @ System.out.print(z+" re");
# n4 @; ]& V; _! V5 {8 d0 P' i }
4 [* r* v$ J p6 {: V7 b' `}
$ m: S0 J' I8 D) ]" Z# |. P
4 o" E! l3 j- s: ~% O4 \结果是:
% z- U3 B/ z/ g/ y" J7 e* hresult is 2
2 S4 W( d* B" G#0 z+ h2 } Y3 Y& _: O1 ~0 a
# An unexpected error has been detected by Java Runtime Environment:
$ v$ N+ r: z: ]7 F#
( q; @) V6 W/ w7 | \0 t# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
) ~6 b* R6 ]; v. Q#
/ z" ~ _! w7 T+ Q' X. x" d! A- F# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)$ i A: Z3 a0 M
# Problematic frame:
* l& U, r) C! A0 c# C [javaswarm.dll+0xb8305]
7 `2 W$ X8 W8 f8 |! I7 L#+ ]0 N; h+ `# Z3 d. k& V
# An error report file with more information is saved as hs_err_pid1064.log |