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
Ïà¹ØÎĵµ£º
×î½üÒª¸Äдһ¸öºËÐļÓÃÜÈÏÖ¤À࣬´ÓC#¸Äд³ÉJava¡£
·¢ÏÖÔÚµ÷ÊÔʱ£¬¼ÓÃܵÄÊý¾ÝÎÞÂÛÈçºÎÒ²¶Ô²»ÉÏ¡£
¾¹ý¸ú×Ù£¬·¢ÏÖÎÊÌâ³öÔÚC#ºÍJava byteÀàÐ͵ÄÇø±ðÉÏ£ºÔÚC#Àï byteÀàÐÍÊÇÎÞ·ûºÅµÄ£¬¶øJavaÀïÊÇÓзûºÅµÄ£¬ËùÒÔC#ÀïµÄ129µ½JavaÀï¾Í³ÉÁ˸ºÊý¡£
·¢ÏÖÁËÎÊÌ⣬½â¾ö¾Í±È½ÏÈÝÒ×ÁË£¬Õë¶ÔJavaµÄbyte£¬²ÉÓÃIntÀ´½øÐд洢¡£
ͨ¹ýÈçÏ´ú ......
Êý¾Ý¿â±íµ¥µÄ´´½¨
mysql> create database shuishengmu;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql & ......
Java
»ù´¡·½Ãæ
:
1
¡¢
char
ÐͱäÁ¿ÖÐÄܲ»ÄÜ´æÖüÒ»¸öÖÐÎĺº×Ö
?
Ϊʲô
?
´ð£º
ÊÇÄܹ»¶¨Òå³ÉΪһ¸öÖÐÎĵģ¬ÒòΪjavaÖÐÒÔunicode±àÂ룬һ¸öcharÕ¼16×Ö½Ú£¬ËùÒÔ·ÅÒ»¸öÖÐÎÄÊÇûÎÊÌâµÄ
2:
À¬»ø»ØÊÕ»úÖÆ
,
ÈçºÎÓÅ»¯³ÌÐò
?
A:javaÖеÄÀ¬»øÊÕ¼¯
£¨Garbage Collection,GC£©ÓÃÀ´»ØÊÕÄÇЩ¹ýÈ¥·ÖÅäµÄ²»ÔÙÓ ......
Jsp
·½Ãæ
jspµÄ³£ÓõÄÃüÁî´ð£ºpage, include, talib, forward,
Servlet
·½Ãæ
1
¡¢ËµÒ»Ëµ
Servlet
µÄÉúÃüÖÜÆÚ
?
´ð:servletÓÐÁ¼ºÃ
µÄÉú´æÆڵĶ¨Ò壬°üÀ¨¼ÓÔغÍʵÀý»¯¡¢³õʼ»¯¡¢´¦ÀíÇëÇóÒÔ¼°·þÎñ½áÊø¡£Õâ¸öÉú´æÆÚÓÉjavax.servlet.Servlet½Ó¿ÚµÄ
init,serviceºÍdestroy·½·¨±í´ï¡£
2
¡¢
Servlet
°æ±¾¼ä
(
ÍüÁ ......