我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
2 F1 D, N q8 }* E aimport swarm.Globals;
$ z( X0 X! N% N" q8 V5 x7 k$ S5 \& @8 L( ^" Q
public class test {" o H- s; _) F2 w; y# A, L
/**
4 u% L0 I3 U& y% p" [# Z * @param args m: D9 J R+ u r! v; S
*/1 I0 m" j( u" z' z
public static void main(String[] args) {9 c0 O" p$ q7 X: M+ E# O
# A4 X2 ]: Q2 A2 s* @0 s6 w" V6 B
int y=(int)(10*Math.random());3 _, c9 b% I6 B) P, Y: R' S
System.out.println("result is "+y);3 \" w5 |7 d+ L3 i9 J% w! }
2 H T# p, h0 V5 U) O double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);. S" h1 D+ t _! K# q; r+ i
System.out.print(z+" re");; r% @. k! L" S! S6 j9 e
}
8 u5 C5 D8 N- ?; r- f, e}
/ G1 r3 g k* R+ q* M w" P: t( @7 G
) J# M: Q: c+ i+ k- E* \结果是:
& O2 _# {) S1 e, M7 }8 Tresult is 2
1 Z) s: `: _4 Q! J" J#
9 } [5 O* J! Y7 {1 ^+ y# An unexpected error has been detected by Java Runtime Environment:
* j/ ]9 F" N3 T#* [/ N6 D, d. }$ i/ t
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
* C0 ^7 L& ]3 O#
6 L, n" C) W, W# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)3 q& J/ w# a9 ^- {
# Problematic frame:# F3 c( d6 v9 x1 H0 n' P
# C [javaswarm.dll+0xb8305]
6 _2 a: U7 `& ]# b## I$ T8 Y& ]) `& U; ^- `
# An error report file with more information is saved as hs_err_pid1064.log |