我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
+ w$ D- W1 E6 R: r" ?+ C2 Oimport swarm.Globals;
% x) h' ~2 c$ X+ V' }5 f" @8 u! D* y# }" W0 Y7 ]0 B- H1 \6 y+ V. A. p
public class test {
: C) o0 b* Z6 g {. k /**; t% a+ ]8 |( z5 ], b8 H5 |. ~# U
* @param args8 u* P7 N, ?1 a b8 U% g# P# s
*/
5 g( M4 Y% _0 f/ b- ^9 Z public static void main(String[] args) {0 B) v3 b4 z) T8 C8 P( d
# N; P+ r" q' @
int y=(int)(10*Math.random());
' a7 W7 a2 b( j, j! c System.out.println("result is "+y);
" P0 ]* y4 A% e2 ^' N0 Y0 D0 U
$ M0 j$ Y2 R; H0 L+ R% W double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);" ^! l# m* L# M+ ]% t
System.out.print(z+" re");5 ~- l/ ]! U, x/ O2 Z
}
3 ^1 i% c4 o/ _; ^) ] r0 k}
2 p5 y7 t: f4 ~3 h% M, ^
/ Y0 P5 o2 y) L) n% f/ S结果是:
& B4 J3 V3 T" D5 n6 J b8 Xresult is 2
% K; F8 }7 O+ g( e5 x$ D! g#) @/ F( Q6 p8 p! w
# An unexpected error has been detected by Java Runtime Environment:
8 `) u& b$ r: }3 ^8 W# n" t1 G4 G$ e0 w
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=10680 Y+ G& s6 M1 b5 O( Z) V& t
#8 L3 V7 K8 t6 T/ \* d
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)
2 |! }- @# ^# M( U# Problematic frame:
) g' h) T; K8 L9 V8 ]# C [javaswarm.dll+0xb8305]
' V% ~; [2 f3 [3 ^8 j/ F#& }9 H8 |' r3 J( V" J3 V8 f. j
# An error report file with more information is saved as hs_err_pid1064.log |