我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
! L% l8 @8 M- b5 _import swarm.Globals;+ E0 }$ D& W* l& C% Z) O, P, a
8 d$ x W! g) V3 A& k4 w) x6 fpublic class test {# O6 Y; t& s* U1 G$ z2 R
/**# w. a" F/ P- o; f0 [$ i. I
* @param args% L( }0 z" ~3 y: T' T% Y
*/
1 F; i9 |5 ?0 o2 o* L5 \, Z o public static void main(String[] args) {
V( j2 D6 @' u) _) v5 S o: Z 0 q% }4 G$ |$ [, A( `4 M7 l9 E
int y=(int)(10*Math.random());, o* O% l. V( Y- T$ F
System.out.println("result is "+y); L1 Z0 z p6 l6 d+ l# O0 T
/ P. R* v, |5 a4 s' ~4 u( y+ C" l% n double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);
6 {& [$ ~7 ? u. t/ N System.out.print(z+" re");4 {$ v+ [* D* f0 q+ G! Y
}# T6 b; c* W9 Y
}1 A- A+ K9 }( H, @2 a
- |% q8 P* q5 k% t; M( Z
结果是:
, m+ o4 u* w' q ]+ [9 V, iresult is 2
7 h8 J0 Z. X7 P4 f( k+ q) N" ^#8 C/ A3 K, C4 t5 a X3 Q5 q5 B1 s
# An unexpected error has been detected by Java Runtime Environment:1 O, t& u$ o; P
## l* ~+ E R( `, _
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
2 N7 \2 \. y$ T- Q# {) T* k#, c6 D. z! v. d
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)& `' T( d0 K( a6 t. k. N
# Problematic frame:0 \: E3 ?) M! ~! x: ?) G6 E# t& b
# C [javaswarm.dll+0xb8305]
' z9 j- L: l! @$ k4 f8 n$ r* Z6 y9 t#
, h5 d2 B6 z1 L, w# An error report file with more information is saved as hs_err_pid1064.log |