我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。( y4 `6 H( t' i. J
import swarm.Globals;
: X( u* v5 X4 a& n9 {: y4 f) b
5 k, t1 ^. b' [, R6 t* ~$ y& Zpublic class test {% V1 }$ m" v) {
/**3 S! E3 R" B( [) C& ^* r+ T! Z: B x
* @param args6 |7 E) K7 a$ N. B0 b
*/
% e# U( A2 s! b6 Q public static void main(String[] args) {
7 I% D g7 Y8 I& u( q- e / q0 K1 o; h3 i
int y=(int)(10*Math.random());
% d9 }: |" J& E3 C( Q: f System.out.println("result is "+y);
" f" o/ B3 o* r3 f8 O- @0 n6 O+ L( Q& T
double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);
) @+ ?4 T( M P8 Y, @ System.out.print(z+" re");' S+ S1 s$ l( ^0 |3 M+ L7 R# A
}
* { T1 y7 d1 j# {" c- i}
2 s! w( U6 n0 E, ~8 J3 n4 f6 V" H( d% n, B( M! h/ x
结果是: I Z+ H! i4 k6 s1 {, U0 \
result is 2
; z) o3 L( v P+ `. W b( d8 t#; L8 ]& t$ _9 ~5 |7 a4 k* Z
# An unexpected error has been detected by Java Runtime Environment:8 l1 h- J' q) p$ O4 M
#: e! r; E; X2 p2 X8 V) c4 L
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
, _) R( U$ S3 y/ d#' g( ]8 D+ Z$ N; C$ ~
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)* F9 L T7 Q4 Q# X c" D/ ~8 c
# Problematic frame:' q0 ?5 H4 L/ q" t# p
# C [javaswarm.dll+0xb8305]0 i! L9 d3 r Z% E; C
#% }" m9 A+ r! S' {! [( s7 L" T
# An error report file with more information is saved as hs_err_pid1064.log |