我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
" S8 g- B5 R) mimport swarm.Globals;. N/ I* d! J& [! c x& X) n
9 T2 ~3 Y) [4 s0 N" E+ ]public class test {
1 l5 c- Q/ B6 [- d: X6 | /**
$ }$ I1 \- r4 }/ T! ] [4 u% B * @param args( ^' O$ b, p' e' H7 a
*/
2 c+ `) l: c2 P6 F' X; c public static void main(String[] args) {! `# P2 e0 W# Z/ e- \9 v
+ C8 S- F2 X) O- w8 I
int y=(int)(10*Math.random());
- p9 b& c2 m4 B; M! c0 I System.out.println("result is "+y);
) u/ @& H$ a8 P" `5 [9 R1 i$ X. ]( }8 ?" C8 C' p7 G. e1 {: V, Z
double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);' T. Z. G; F$ l! M& }+ f5 C0 i- W
System.out.print(z+" re");
$ Q1 A' O4 }; ^8 `, b |- E1 Z! U% |) m }
" S& a' e% a! a8 i& _9 k- ~1 Q$ T}, F6 u9 y5 j% V0 L9 H) ]$ e5 ~
w0 A9 h" y& l3 |
结果是:8 M, w1 |% N6 u+ q2 W+ O
result is 2
4 O7 n/ k6 h- ~3 Q# C#
$ F7 s3 C9 w/ Y# An unexpected error has been detected by Java Runtime Environment:0 U, N* j" i# V) w
#$ R3 m0 \/ I! W% o
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068# Z- V3 h9 i# e' t: e, @9 U
#
" B4 a$ T/ K7 D9 S$ b# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing) A4 Q0 I* p: h8 S& R6 d' s
# Problematic frame:
* X" g9 Z/ f/ V" K# C [javaswarm.dll+0xb8305]# N* P8 M1 O7 d5 b; X
#- J% `, ]$ [$ Q6 o" Q
# An error report file with more information is saved as hs_err_pid1064.log |