我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
* [% I, w- T2 a* K6 b- c6 b- f1 W% D* Zimport swarm.Globals;1 E. w U- E3 N1 m
" x: y' h9 r% s) Opublic class test {
$ w* y' j9 H2 }$ K' }# p/ _4 P9 ] /**
$ d' A) D, I- ` * @param args
5 E( Q; g8 X) \ */. b& U% u) \. ?" [6 a: Z H% P
public static void main(String[] args) {
% c. v9 j6 ?- c
8 T# u$ I% L2 X/ J- y* X8 I int y=(int)(10*Math.random());* t8 A0 L) Z L' e9 \" x1 S
System.out.println("result is "+y);
# @* x) `# _) Q" `$ Q) }8 y' t. m* Z1 d Y+ u
double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);
A' s4 @6 J8 U! z, I& s% ^ System.out.print(z+" re");9 T+ B, w( c. R9 L9 ^6 z% v# v. y! D
}
0 z+ f; p- B4 p4 i7 N}1 J& \" g3 r: l5 V" X
6 D/ j- p) R+ T3 y$ y9 x3 y结果是:
% u7 L+ l1 R( m. y/ D2 h4 Nresult is 22 @1 ]" @& J* Q1 c. |5 }( e: [6 q* ?
#
! c- j, R/ s" n( F1 z7 ?4 Z$ A# An unexpected error has been detected by Java Runtime Environment:& ~- B+ l, J6 i4 m+ m5 P5 R3 D2 c
#6 t2 o5 f; |; q* o
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
& M1 _" o3 J; }$ O. R2 M#
* M6 c" @* b: D, ]2 {. `# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)
* h4 W0 a1 }$ V# Problematic frame:
' V( x1 m/ P, z, d; W c3 _# C [javaswarm.dll+0xb8305]
. D3 D( d" R0 D1 ?# ^" g! m$ d+ I#
/ W. A# V1 Z% C% X7 l$ I$ [7 q# An error report file with more information is saved as hs_err_pid1064.log |