我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。- O k4 U; z8 ~4 N, T" ~
import swarm.Globals;+ {# E5 s* m0 _/ S- l. a
1 g5 ^9 P2 ^/ J) w* G
public class test {
# m% Z/ D {+ L/ c3 t) ~ /**
1 U! e, w M2 R$ N/ l6 W8 \ * @param args
! |0 h h- d) u5 z2 P */
+ V' q2 B! S# u, s# l. W7 K public static void main(String[] args) {3 Y0 l% j/ U: x$ _1 |3 V# V9 n# ]( C
: i8 Y+ m) }4 N int y=(int)(10*Math.random());
. S8 r) w }, p! \! z System.out.println("result is "+y);7 [3 P! e3 D1 Y6 }6 g5 r6 p4 L& ?
5 \; m: c& B( l. i! }) G double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);9 ]- Y+ ?/ B2 p; K9 U* H
System.out.print(z+" re");
; D, U. c7 u' V+ |& [) [1 B+ r }# E/ g* j- B; s5 s/ U4 ]
}
2 j% N; z$ \3 H/ b! w; x6 d; H. a3 x% q$ @, I5 D5 S/ M8 z
结果是:
6 E8 i& V7 T) Q3 Jresult is 2$ a J2 y6 @2 T! Q/ l
#. C% K4 m# m4 V3 J* U' R7 N
# An unexpected error has been detected by Java Runtime Environment:9 a, Q W7 t7 T/ f% C
#
+ P- R0 ]0 ^9 O; R2 s# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068 ?8 ]4 o' n y' F" r$ E
#
l4 K8 l7 N2 b3 L( I# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)
0 a8 @" z, p2 g5 @3 `5 [, V; n# Problematic frame:
7 H( I' ~5 ?/ ~$ _# f0 h# [: w# C [javaswarm.dll+0xb8305]
0 [) k& R: b: h0 d#
; d7 Y( M1 {4 S# An error report file with more information is saved as hs_err_pid1064.log |