我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
3 k" L! N* _0 Q8 B: l/ `5 j: R' Y; mimport swarm.Globals;
# q7 ]* K% H7 x* x
S1 c) s0 q! _. A; ^3 j1 g, zpublic class test {
/ ]7 y* y) }$ T/ f6 N8 v$ q" z /**
2 N" M2 S. T% K, u6 f* l. w * @param args4 v2 a+ b. c2 D
*/ u" g9 |# u9 [: ]( a8 k
public static void main(String[] args) {. _( G( q! f! N# H
4 c+ Q% p( A; z; y- E0 h; h1 A1 H5 y int y=(int)(10*Math.random());
# ?2 t x$ l% _+ m System.out.println("result is "+y);
: B) O/ M! G6 G7 d9 Q6 p1 U5 R; h ~6 h4 @* O: D% D
double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);6 J' Y/ @( k, E' H* \; L
System.out.print(z+" re");
* T9 W3 p) r2 p6 ~+ N# b }
. d5 z! j2 q: x m# k8 `}6 F! i8 G" J* {9 }& l9 W( |+ t
/ D4 J7 W0 `; U! b
结果是:/ @# i! b* K: Y" C. S/ x
result is 2
" C4 S n& o3 R, t3 K#
/ B. s% X* N) G5 y3 L. Z* L# An unexpected error has been detected by Java Runtime Environment: {2 H. }# C3 t9 [' y' @! i/ }
#4 W$ z4 ~0 Z2 {! X' s6 @
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
3 L, X( e9 [3 x; O/ O#
! D2 L+ ]4 t6 _3 I+ r& y+ c7 f# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)
9 r& p% a6 w/ G6 S- I' Q# Problematic frame:
( E h: x0 B! _# ~- N% y# n o# C [javaswarm.dll+0xb8305]2 V' E3 U4 D) n0 }2 K
#
, `: J: d7 ~9 O) b) g, K# An error report file with more information is saved as hs_err_pid1064.log |