我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
0 v; U! G2 [; p6 Timport swarm.Globals;
- D9 b4 _ O" M) `% w1 N" C& o4 j
" z) g- r0 u( I: |0 Y2 t8 w# Lpublic class test {
& ^! x) b4 i& b6 i# I% d. A( J /**
4 X& I, W0 t6 O4 {% g * @param args) m; O2 w$ `# a t# {9 @/ ?$ Z7 C
*/$ A. K( ]/ j7 \8 p# @ s
public static void main(String[] args) {
5 x0 i) b* e+ F- a% X+ Q
* z: g3 y6 j- C0 i( W4 d+ { int y=(int)(10*Math.random());
9 q' L: W2 B* \: f System.out.println("result is "+y);) R+ ]9 q( c" J m8 R
7 D7 ~0 N; d" T4 i; x# u. o, Q
double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);# Z H6 r7 E2 p1 n# [/ y, \
System.out.print(z+" re");6 E- x* l" R- P8 k8 T6 \
}$ |' h3 P B! Z; Q
}2 R R' \6 s; a* `6 A3 D/ Q# g+ H
5 Q, x, j0 I8 y6 Y
结果是:
; Q7 u" Q2 j5 V% ^$ Nresult is 2
6 u/ c7 L, k/ ^% T% K7 b#
8 G3 c9 e/ t- u# An unexpected error has been detected by Java Runtime Environment:
2 L9 Y+ Z" l8 t. G7 R% a2 ]# T#4 h( k, p$ {5 q5 `. m
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
) |, ^! E0 _3 O) u9 s$ E& e1 N1 i# ?7 n" `8 i0 Z% N
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing): \/ e& J: E/ h5 s; t$ z
# Problematic frame:
6 R9 R+ F. t; \% _# C [javaswarm.dll+0xb8305]
- B g( G3 P; v2 o" J0 K#
% K! s6 P1 [! P, ~4 k# An error report file with more information is saved as hs_err_pid1064.log |