我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
2 O/ F" v8 A" Gimport swarm.Globals;
6 r8 x; e3 m) u+ A; m5 o z0 F# `" U7 j/ F+ ~3 ~2 n* G+ E8 c. ]3 u
public class test {
3 \ h/ U& v( K: |1 f /**
7 U# @; F# L+ v& `( _% l% h * @param args$ N- R' P% `1 O" _: Y
*/9 _3 d9 m+ r- ^7 x3 I
public static void main(String[] args) {6 F! V* O5 I8 H, k
6 {& }" `& `; Q6 f3 g/ T int y=(int)(10*Math.random());
! w% b. U) ~2 ^' a* B" H8 t0 e System.out.println("result is "+y);
! q% u; J4 t0 n) y4 Y$ q0 }: f
$ E. L b$ B; n0 P# R7 Q" H% a9 | double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);
& e/ ]" d: ^: T% k' d System.out.print(z+" re");4 c: W! @0 P/ Z
}
* _) u9 G# T2 b* i9 q}
, P+ x0 c0 g9 A/ e' H/ W _' F' b- o- u- X
结果是:
$ T) x# i9 o: P8 Rresult is 23 K7 x: F% A+ [) f/ i6 f
#
6 x; y& h# S3 g$ G8 v4 |3 F, ?* \# An unexpected error has been detected by Java Runtime Environment:
" ~- r( j, l9 [$ ^. V#4 p3 K4 V8 g. ^6 y- @) Z; z" i
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068, i$ ~* @" t$ f. K
#
, E# ?* R! C% `# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)2 d5 \# v# }* h6 e
# Problematic frame:
/ T2 q! I# \- v* O: ]# C [javaswarm.dll+0xb8305]0 I0 b1 C5 L6 W# m, V
#8 C% ~' Y4 e& w) `- n% U
# An error report file with more information is saved as hs_err_pid1064.log |