我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
1 D1 P$ |" f- |- b2 B7 h& wimport swarm.Globals;1 u" A0 M- r& J- U
1 r( D) a8 h: V5 u; E- apublic class test {6 x& k) ]# c m- h. Q) Q
/**
) ]% S, x( x" V0 J; l * @param args+ t$ O) U" f3 ^5 u* `3 `8 p4 B2 k
*/. }, j) W7 D* l1 C+ U) Y
public static void main(String[] args) {/ K3 @6 x! b1 z& M
7 Z- f% r* |' o7 U; a$ z9 P/ }0 u int y=(int)(10*Math.random());
3 @& B! b+ g. S( h/ q. g. l System.out.println("result is "+y);* g9 m* U$ m% I7 L/ }, q/ H1 C. o
. A$ o7 W1 q6 H! [/ O# B% T! h0 ? double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);
4 L" E- ~* k1 N& l% {* Z System.out.print(z+" re");
$ b* e6 n9 n8 K, S }+ o; E; b9 ]" a7 q
}
9 {$ x# C( b( b! M
$ l- E1 ?& s3 T结果是:
2 O1 a# E. @) G- m! h2 P0 dresult is 25 p" a3 ^4 u: a( F& e
#9 e* U, h9 x# m! e' [& X: Q
# An unexpected error has been detected by Java Runtime Environment:
' I" \( O1 \1 G4 d, A#; `+ A( r t. U b% @7 n; N
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068! O& d E9 r. V
#' R9 R5 U$ x$ [, a
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)! r6 \9 r9 s* Y" D" _+ A
# Problematic frame:' ^* @% ?# R$ E5 _& K
# C [javaswarm.dll+0xb8305]
; m9 P- B! ]1 O#) \! [6 v# \" y
# An error report file with more information is saved as hs_err_pid1064.log |