我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
2 x7 I5 t) b L( |. ^import swarm.Globals;
9 F8 ~1 A* ]' n7 L: ?! ?+ M) H
3 U: C" }3 o: K1 Tpublic class test {
" X' J9 p4 C, i5 C. n /**4 x+ I* f2 T. \3 K$ v+ l" l, E& e
* @param args
9 I0 _7 a4 r' f* Q */3 D" D U2 t$ z& U
public static void main(String[] args) {
9 I) X# }4 D' K' L # P/ `1 H) }: V( J
int y=(int)(10*Math.random());: K% F; l4 Z' G0 l& k' G* M8 ~
System.out.println("result is "+y);
: [# S$ _* N7 r3 c9 y
* X. a5 v8 N+ r4 v4 _ double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);# V: K& M+ c9 ~, V
System.out.print(z+" re");
" L0 P5 j- ?+ R6 e }* X C; {: K- n' v9 T
}9 D( l1 p6 m& o1 G3 b9 \
/ i0 [: I: |# B. C
结果是:
4 w/ G& Z1 G9 `result is 2
- u8 U7 m/ `* M( N' m, H4 D#
1 j" }% g8 Z* O: y: w# An unexpected error has been detected by Java Runtime Environment:5 G9 {3 A1 Z$ d- x- m
#
9 o; F; P4 S' Q# _2 r8 N# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
6 u2 l6 H( h* b6 O& n#9 ^3 Q; `$ {7 c6 ?9 Z! V3 b
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)8 x; g% u+ }; j6 D( H; Q
# Problematic frame:: ~" }, e; p9 J3 ^3 W( w, {' a
# C [javaswarm.dll+0xb8305]4 Y9 }9 W6 ~- E* d: I
#
4 e2 G! ^3 ]/ `4 I/ R( [( Z# An error report file with more information is saved as hs_err_pid1064.log |