JavaÊÖ²áÖÐjava.util.RandomµÄÃèÊö£¬Ëæ»úÊý²úÉúËã·¨
java.util
Àà Random
java.lang.Object
java.util.Random
ËùÓÐÒÑʵÏֵĽӿڣº
Serializable
Ö±½ÓÒÑÖª×ÓÀࣺ
SecureRandom
public class Random
extends Object
implements Serializable
´ËÀàµÄʵÀýÓÃÓÚÉú³ÉαËæ»úÊýÁ÷¡£´ËÀàʹÓà 48 λµÄÖÖ×Ó£¬Ê¹ÓÃÏßÐÔͬÓ๫ʽ¶ÔÆä½øÐÐÐ޸ģ¨Çë²ÎÔÄ Donald Knuth µÄ¡¶The Art of Computer Programming, Volume 2
¡·£¬µÚ 3.2.1 ½Ú£©¡£
Èç¹ûÓÃÏàͬµÄÖÖ×Ó´´½¨Á½¸ö Random
ʵÀý£¬Ôò¶Ôÿ¸öʵÀý½øÐÐÏàͬµÄ·½·¨µ÷ÓÃÐòÁУ¬ËüÃǽ«Éú³É²¢·µ»ØÏàͬµÄÊý×ÖÐòÁС£ÎªÁ˱£Ö¤ÊôÐÔµÄʵÏÖ£¬ÎªÀà Random
Ö¸¶¨ÁËÌض¨µÄËã·¨¡£ÎªÁË Java ´úÂëµÄÍêÈ«¿ÉÒÆÖ²ÐÔ£¬Java ʵÏÖ±ØÐëÈÃÀà Random
ʹÓô˴¦ËùʾµÄËùÓÐËã·¨¡£µ«ÊÇÔÊÐí Random
ÀàµÄ×ÓÀàʹÓÃÆäËûËã·¨£¬Ö»ÒªÆä·ûºÏËùÓз½·¨µÄ³£¹æж¨¼´¿É¡£
Random
ÀàËùʵÏÖµÄË㷨ʹÓÃÒ»¸ö protected
ʵÓù¤¾ß·½·¨£¬Ã¿´Îµ÷ÓÃËü¶¼¿ÉÌṩ×î¶à 32 ¸öαËæ»úÉú³ÉµÄλ¡£
ºÜ¶àÓ¦ÓóÌÐò»á·¢ÏÖ Math
ÀàÖÐµÄ random
·½·¨¸üÒ×ÓÚʹÓá£
´ÓÒÔÏ°汾¿ªÊ¼£º
JDK1.0
ÁíÇë²Î¼û£º
Math.random()
,
ÐòÁл¯±í¸ñ
¹¹Ôì·½·¨ÕªÒª
Random
()
´´½¨Ò»¸öеÄËæ»úÊýÉú³ÉÆ÷¡£
Random
(long seed)
ʹÓõ¥¸ö long
ÖÖ×Ó´´½¨Ò»¸öÐÂËæ»úÊýÉú³ÉÆ÷£º
public Random(long seed) { setSeed(seed); }
next
·½·¨Ê¹ÓÃËüÀ´±£´æËæ»úÊýÉú³ÉÆ÷µÄ״̬¡£
·½·¨ÕªÒª
protected int
next
(int bits)
Éú³ÉÏÂÒ»¸öαËæ»úÊý¡£
boolean
nextBoolean
()
·µ»ØÏÂÒ»¸öαËæ»úÊý£¬ËüÊÇ´Ó´ËËæ»úÊýÉú³ÉÆ÷µÄÐòÁÐÖÐÈ¡³öµÄ¡¢¾ùÔÈ·Ö²¼µÄ boolean
Öµ¡£
void
nextBytes
(byte[] bytes)
Éú³ÉËæ»ú×Ö½Ú²¢½«ÆäÖÃÓÚÓû§ÌṩµÄ×Ö½ÚÊý×éÖС£
double
nextDouble
()
·µ»ØÏÂÒ»¸öαËæ»úÊý£¬ËüÊÇ´Ó´ËËæ»úÊýÉú³ÉÆ÷µÄÐòÁÐÖÐÈ¡³öµÄ¡¢ÔÚ 0.0
ºÍ 1.0
Ö®¼ä¾ùÔÈ·Ö²¼µÄ double
Öµ¡£
float
nextFloat
()
&nb
Ïà¹ØÎĵµ£º
½ñÌìѧϰÁËapplet²¼¾ÖÎÊÌ⣺
°´Å¥¡¢±êÇ©ÊÇÔõÑù¼ÓÈëµ½applet³ÌÐò(ÈÝÆ÷)µ±ÖÐÈ¥µÄÄØ£¿
ÐèÒªÓõ½²¼¾ÖÈÝÆ÷¹ÜÀíÆ÷(LayoutManager)£ºËüÓÃÓÚÐÖúÈÝÆ÷È·¶¨¼ÓÈëµÄ×é¼þ(°´Å¥µÈ)Ó¦¸Ã·ÅÖõÄλÖÃ
awtÌṩÁË4Öг£ÓõIJ¼¾ÖÈÝÆ÷¹ÜÀíÆ÷
>>FlowLayout
>>BorderLayout
>>GridLayout
>>CardLayout
appletĬÈÏÊ¹Ó ......
ʹÓÃRuntime.getRuntime().exec()·½·¨¿ÉÒÔÔÚjava³ÌÐòÀïÔËÐÐÍⲿ³ÌÐò.
¸Ã·½·¨ÓÐ6¸ö¿É·ÃÎÊ°æ±¾:
1.exec(String command)
2.exec(String command, String envp[], File dir)
3.exec(String cmd, &n ......
Êý¾Ý¿â±íµ¥µÄ´´½¨
mysql> create database shuishengmu;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql & ......
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class LinkAccess {
/**
* @param args
*/
public stat ......
ÏÖÔÚÓÃlinuxµÄÅóÓÑÔ½À´Ô½¶àÁË£¬Ç°¼¸Ìì¾ÍÓÐÁ½¸öÅóÓÑÎÊÎÒlinuxÏÂÔõôÅäÖÃjava»·¾³£¬ÎÒÏ뻹ÓкܶàÅóÓÑÏëÁ˽âѧϰÕâ·½ÃæµÄ¶«Î÷£¬¾Íдһ¸öÍêÈ«Ò»µãµÄlinux java»·¾³ÅäÖðɣ¬Ï£Íû¶Ô´ó¼ÒÓаïÖú¡£
Ò». ÏÂÔØjdk5.0 for linux
¡¡¡¡µ½sunµÄÖ÷Ò³ http://java.sun.com/j2se/1.5.0/download.jsp ÏÂÔØjdk°²×°Îļþjdk-1_5_0_05-linux-i586 ......