我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
- t* t, t, c8 X5 R4 |: [) p: ~import swarm.Globals;
; S# s( A+ s, N" @2 q8 Z; B) J0 Q- Q; Q
public class test {
" I+ J6 Z( I4 m8 |5 }' K% t /**
) A5 d3 w) `" t' @6 |' ~ * @param args
+ P7 |& o- n" H2 j9 L */
7 U2 I, X3 o- @4 P3 } public static void main(String[] args) {& V: O3 h5 a9 g8 [9 Y" @$ ]
, ~0 |) c. L+ _2 K) C
int y=(int)(10*Math.random());
/ D* |: V$ v+ Q6 Z9 A/ Z, X System.out.println("result is "+y);0 {% M' w: a L4 U1 M) R n
+ O4 |6 a& Y ~0 M5 ?# J double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);
( M% i9 ?5 P* A! I; g System.out.print(z+" re");: v- d% D- C' I# \ k
}
4 j+ M; g" C* [# B0 G# |4 x+ k}2 |1 J& L* B& C! _8 c2 _# b
7 R6 v o$ z! G
结果是:
8 [: O4 |( _6 r+ [# d9 K# b2 nresult is 2
8 V; @% c& b! r0 j# M% s( ~4 ?* [
# An unexpected error has been detected by Java Runtime Environment:
1 {3 S# h1 F# l: M9 o) C#& S2 s3 u j& I4 c* B5 a
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
: ^& T v7 g6 ?: w& a#
4 F3 V( f' g, }9 n- v8 g# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing)9 S( E' } F: J) a' E
# Problematic frame:
& @. f- K, ]* O9 x: y/ T' \# C [javaswarm.dll+0xb8305]
A; c& ~4 [. e# y, o1 O3 Y#) c- |2 `; D5 D( g& D
# An error report file with more information is saved as hs_err_pid1064.log |