我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。- U B* j/ D# C2 h( H+ }
import swarm.Globals;
) _ V2 f& L/ f4 y6 x* N" g$ o8 J' v% W3 g
public class test {
5 u; y" E* g* J9 P0 Q, S /**
& |. L6 V& _7 P1 r4 U * @param args
1 Y! k w! P/ u7 ]5 E' u */ O8 J; D: C9 n6 s
public static void main(String[] args) {
6 k! i$ _" x; q7 s4 y1 P2 H" {
4 }4 F) M- _( `! R) _/ E2 e* f* z int y=(int)(10*Math.random());9 ~ b) l; Q5 k" d5 [3 S: `
System.out.println("result is "+y);$ A, N2 _5 ^3 i; j# z& p
9 t' m! o# _3 Z$ c* y5 `
double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);
5 |; L! `2 F6 Z2 v' w System.out.print(z+" re");
+ F0 Y" B$ L/ L ^! d- F7 N }
) h, E! A3 w t: M. U. D}
8 S) C* O! B- K! J! r* ~$ r' x
- W2 y; T3 O( P8 \ q结果是:
5 b+ o" b. r4 Y& u5 r. P' Lresult is 2/ U1 R2 O: {9 }8 _2 @
#- n3 S3 s/ q) ?& p" e
# An unexpected error has been detected by Java Runtime Environment:
% |6 P9 z0 E- s% r#; r. `! Z5 T! b L6 X' v d% d
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=10689 c6 X1 G. ~9 r& N0 b
#6 F' ^/ A4 v3 N* ^! N; j9 T0 \$ o
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)
Z. z6 |. ?9 ^. [7 Q1 Q1 W% ?. i# Problematic frame:
# O* e9 A% Z! B& ^2 G4 Y" l+ r7 m# C [javaswarm.dll+0xb8305]
d- e' i1 g1 t5 K3 X+ q#& p9 E5 X: u$ ?% f) P
# An error report file with more information is saved as hs_err_pid1064.log |