عرض مشاركة واحدة
  #1 (permalink)  
قديم 2008-11-13, 09:42 PM
IM.com IM.com غير متواجد حالياً
:: إدارة تقنية المعلومات ::
 
تاريخ التسجيل: 01-11-2008
المشاركات: 145
افتراضي كود بسيط لتوليد ارقام عشوائية

كود PHP:
Dim objRandom As New System.Random_
  CType
(System.DateTime.Now.Ticks Mod System.Int32.MaxValueInteger)) 

Public Function 
GetRandomNumber_
  Optional ByVal Low 
As Integer 1_
  Optional ByVal High 
As Integer 100) As Integer
  
' Returns a random number,
  ' 
between the optional Low and High parameters
  
Return objRandom.Next(LowHigh 1)
End Function 
وطريقة استدعائها هي كالتالي :


كود PHP:
Dim MyRand As Integer
 MyRand 
GetRandomNumber(16)
 
MessageBox.Show("Your Random Number Is " MyRand.ToString
رد مع اقتباس