我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。4 k' f$ n" \, U2 S1 I% A( j, H1 D. X
import swarm.Globals;
0 W. j7 f' X& {5 C8 p* B+ i1 B3 Z) d9 ^% F7 O' V' J0 R3 k6 [' r I
public class test {5 Q# w2 S: M$ T- H7 f( s' x
/**# W W: r+ i1 Z/ [& X
* @param args
& B: B7 [/ K! c; ?2 |+ Q */
6 Z; r, V1 _ c; y' e! n$ q& v public static void main(String[] args) {' B: B. l# J* P7 c' L, F: f2 {
$ P. C/ E9 @4 g7 i
int y=(int)(10*Math.random());
, y# K, L& d5 r, U System.out.println("result is "+y);
0 ^ j! V5 P4 ~& p( M; u: ?* L A; b! b# R2 I
double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);
- [% |# T: K. M- w5 Y+ H" }% F) @ System.out.print(z+" re");
+ H5 |$ W" w, y' Q/ w }
( z9 E/ s( Q/ L' H; z0 |}
+ Z1 n$ ^9 E1 u: D! k) S" s9 l9 `2 ?0 f
结果是:
) T0 l1 D2 @; q* eresult is 2
3 @( _/ l# Q+ c#
# D+ w, R r9 K# ]! e# An unexpected error has been detected by Java Runtime Environment:7 Q# R; B4 [, U4 n1 ^, u2 m
#
$ U$ ^7 u) P) I# B7 @. @# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
9 u7 H! }2 `* U" r& I7 N#0 _# r+ _+ C7 \# V l9 v
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)
4 a4 C n! J4 F' c# Problematic frame:
& r8 H( K) W2 ?- r# C [javaswarm.dll+0xb8305]
8 {; ?' x, S1 `" n, t#/ w" l. W0 M$ c, _/ E' x
# An error report file with more information is saved as hs_err_pid1064.log |