我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
+ O) j3 ?* |9 D3 k j* Nimport swarm.Globals;- K Z% k; B( v0 j( h3 I0 k: V
2 B$ T! \6 ]7 a6 b* V) f7 h h' u
public class test {0 F/ }$ S! I1 N6 b5 R
/**' g$ l2 r# E4 o! c) O
* @param args
! u8 x& [( w; W( W" x */: N L! x. j* S" `
public static void main(String[] args) {
; ^' c3 u& n; z% E: H/ j$ k9 N2 Y
7 `9 e7 o6 y! g) Y int y=(int)(10*Math.random());7 `# m9 b- q' P6 g( A" @8 k
System.out.println("result is "+y);
& B5 l0 h- m7 h- _& r
, X; f7 @) c8 u" d double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);
* ?( e0 p: |" l9 x+ y0 X l System.out.print(z+" re");
) d* Y6 r0 K# u }
8 ~) `8 m9 L5 v5 S! P: d2 h}
' q& @+ j; G- n$ b0 D# F& w$ Q+ [" @- W- b* w" Q8 C
结果是:
2 [$ ]) w" ]6 g: V$ C: a, U2 N: H9 C7 Zresult is 2& p1 x; l6 ]2 P0 B) { `: h0 g
#1 V% l$ U7 s+ s# l
# An unexpected error has been detected by Java Runtime Environment:+ i$ I$ _! }) z( f6 m! e% }) A3 J
#
" {. o. ^. x, z' u# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
6 a8 \9 K2 s8 p0 `2 p#6 j, d8 X9 N6 J+ s
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)
& I3 R o. R S1 I# Problematic frame:
$ w7 r% s0 j q- d: A) H% l# C [javaswarm.dll+0xb8305]
% `& x; m! G9 m0 u& j. t* E# K#
- v; p# _: B' I ]& h1 _, n6 S$ u# An error report file with more information is saved as hs_err_pid1064.log |