我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
( V, Y. P% ^, N, n! himport swarm.Globals;
6 C. ?7 [4 Z% R$ q5 Y5 R& V
^ H) h y4 J8 s3 j5 Apublic class test { I# b5 f f8 `8 Y: s
/**( h5 @$ Y* x, D- j! m
* @param args1 {5 r8 {7 Y: [0 X! j* w! {
*/. t# F F. ]# E4 d' y
public static void main(String[] args) {
7 Z) N' O5 \) l( o 1 Q, G8 O# n6 X1 @; x' M7 f- X
int y=(int)(10*Math.random());
0 \4 C- V) B9 H K( ~. l System.out.println("result is "+y);
/ ]7 M2 \4 h( V7 F# P
% K6 _5 O: J- A* Z. \4 G double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);
) r4 W1 |5 m0 n/ P/ g3 A System.out.print(z+" re");, u1 U( m; b6 |
}
) u9 G& P# c- }/ Q; Y7 c}
, _7 \' S6 y) F- [3 N3 U; j* w# k/ P7 \7 n
结果是:
/ `7 b$ Q& Y/ _result is 2
6 F: y# @' `' w3 s& k4 @% R#
/ z. E- x! a5 f; a# An unexpected error has been detected by Java Runtime Environment:
u5 ^% p6 \4 i0 i4 M- m/ c8 W2 v#
4 I/ ?8 R `) c+ n) r3 C! }/ N# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068" t7 t5 t/ V$ ]$ \
#
$ J k, m& B- \' t, p1 r" |; U# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)
# _- F, Q& P' [6 [# Problematic frame:
) ` z: q6 X" j4 j9 s' e- h# C [javaswarm.dll+0xb8305]
; h5 H$ a: X1 G4 b3 i* O#* |" X5 _: }2 c4 L
# An error report file with more information is saved as hs_err_pid1064.log |