PDA

View Full Version : کد رندوم!( Random)



baran66
یک شنبه 17 تیر 1386, 22:58 عصر
دوستان عزیز من برنامه ی جور چین رو نوشتم اما با کد رندوم مشکل دارم
لطف کنین این کد رو برای من بزارین!!!

samira3
دوشنبه 18 تیر 1386, 01:41 صبح
سلا م
من از زمبه سوال کردم برایanim_fxجواب گرفتم اگه می خوای برات بگم
کد
Timer1.Enabled = True
Timer2.Enabled = True
Dim generate AsNewBoolean
Dim p(17) AsInteger
Static RandomNumGen AsNew System.Random
generate = False
While generate = False
Label1.Text = RandomNumGen.Next(1, 17)
p(1) = Label1.Text
While Label1.Text = p(1)
Label1.Text = RandomNumGen.Next(1, 17)
p(2) = Label1.Text
EndWhile
While Label1.Text = p(1) Or Label1.Text = p(2)
Label1.Text = RandomNumGen.Next(1, 17)
p(3) = Label1.Text
EndWhile
While Label1.Text = p(1) Or Label1.Text = p(2) Or Label1.Text = p(3)
Label1.Text = RandomNumGen.Next(1, 17)
p(4) = Label1.Text
EndWhile
While Label1.Text = p(1) Or Label1.Text = p(2) Or Label1.Text = p(3) Or Label1.Text = p(4)
Label1.Text = RandomNumGen.Next(1, 17)
p(5) = Label1.Text
EndWhile
While Label1.Text = p(1) Or Label1.Text = p(2) Or Label1.Text = p(3) Or Label1.Text = p(4) Or Label1.Text = p(5)
Label1.Text = RandomNumGen.Next(1, 16)
p(6) = Label1.Text
EndWhile
While Label1.Text = p(1) Or Label1.Text = p(2) Or Label1.Text = p(3) Or Label1.Text = p(4) Or Label1.Text = p(5) Or Label1.Text = p(6)
Label1.Text = RandomNumGen.Next(1, 16)
p(7) = Label1.Text
EndWhile
While Label1.Text = p(1) Or Label1.Text = p(2) Or Label1.Text = p(3) Or Label1.Text = p(4) Or Label1.Text = p(5) Or Label1.Text = p(6) Or Label1.Text = p(7)
Label1.Text = RandomNumGen.Next(1, 17)
p(8) = Label1.Text
EndWhile
While Label1.Text = p(1) Or Label1.Text = p(2) Or Label1.Text = p(3) Or Label1.Text = p(4) Or Label1.Text = p(5) Or Label1.Text = p(6) Or Label1.Text = p(7) Or Label1.Text = p(8)
Label1.Text = RandomNumGen.Next(1, 17)
p(9) = Label1.Text
EndWhile
While Label1.Text = p(1) Or Label1.Text = p(2) Or Label1.Text = p(3) Or Label1.Text = p(4) Or Label1.Text = p(5) Or Label1.Text = p(6) Or Label1.Text = p(7) Or Label1.Text = p(8) Or Label1.Text = p(9)
Label1.Text = RandomNumGen.Next(1, 17)
p(10) = Label1.Text
EndWhile
While Label1.Text = p(1) Or Label1.Text = p(2) Or Label1.Text = p(3) Or Label1.Text = p(4) Or Label1.Text = p(5) Or Label1.Text = p(6) Or Label1.Text = p(7) Or Label1.Text = p(8) Or Label1.Text = p(9) Or Label1.Text = p(10)
Label1.Text = RandomNumGen.Next(1, 17)
p(11) = Label1.Text
EndWhile
While Label1.Text = p(1) Or Label1.Text = p(2) Or Label1.Text = p(3) Or Label1.Text = p(4) Or Label1.Text = p(5) Or Label1.Text = p(6) Or Label1.Text = p(7) Or Label1.Text = p(8) Or Label1.Text = p(9) Or Label1.Text = p(10) Or Label1.Text = p(11)
Label1.Text = RandomNumGen.Next(1, 17)
p(12) = Label1.Text
EndWhile
While Label1.Text = p(1) Or Label1.Text = p(2) Or Label1.Text = p(3) Or Label1.Text = p(4) Or Label1.Text = p(5) Or Label1.Text = p(6) Or Label1.Text = p(7) Or Label1.Text = p(8) Or Label1.Text = p(9) Or Label1.Text = p(10) Or Label1.Text = p(11) Or Label1.Text = p(12)
Label1.Text = RandomNumGen.Next(1, 17)
p(13) = Label1.Text
EndWhile
While Label1.Text = p(1) Or Label1.Text = p(2) Or Label1.Text = p(3) Or Label1.Text = p(4) Or Label1.Text = p(5) Or Label1.Text = p(6) Or Label1.Text = p(7) Or Label1.Text = p(8) Or Label1.Text = p(9) Or Label1.Text = p(10) Or Label1.Text = p(11) Or Label1.Text = p(12) Or Label1.Text = p(13)
Label1.Text = RandomNumGen.Next(1, 17)
p(14) = Label1.Text
EndWhile
While Label1.Text = p(1) Or Label1.Text = p(2) Or Label1.Text = p(3) Or Label1.Text = p(4) Or Label1.Text = p(5) Or Label1.Text = p(6) Or Label1.Text = p(7) Or Label1.Text = p(8) Or Label1.Text = p(9) Or Label1.Text = p(10) Or Label1.Text = p(11) Or Label1.Text = p(12) Or Label1.Text = p(13) Or Label1.Text = p(14)
Label1.Text = RandomNumGen.Next(1, 17)
p(15) = Label1.Text
EndWhile
While Label1.Text = p(1) Or Label1.Text = p(2) Or Label1.Text = p(3) Or Label1.Text = p(4) Or Label1.Text = p(5) Or Label1.Text = p(6) Or Label1.Text = p(7) Or Label1.Text = p(8) Or Label1.Text = p(9) Or Label1.Text = p(10) Or Label1.Text = p(11) Or Label1.Text = p(12) Or Label1.Text = p(13) Or Label1.Text = p(14) Or Label1.Text = p(15)
Label1.Text = RandomNumGen.Next(1, 17)
p(16) = Label1.Text
EndWhile
generate = True
EndWhile

Button1.Visible = True
Button2.Visible = True
Button3.Visible = True
Button4.Visible = True
Button5.Visible = True
Button6.Visible = True
Button7.Visible = True
Button8.Visible = True
Button9.Visible = True
Button10.Visible = True
Button11.Visible = True
Button12.Visible = True
Button13.Visible = True
Button14.Visible = True
Button15.Visible = True
Button16.Visible = True

Button1.Top = t(p(1))
Button1.Left = l(p(1))
Button2.Top = t(p(2))
Button2.Left = l(p(2))
Button3.Top = t(p(3))
Button3.Left = l(p(3))
Button4.Top = t(p(4))
Button4.Left = l(p(4))
Button5.Top = t(p(5))
Button5.Left = l(p(5))
Button6.Top = t(p(6))
Button6.Left = l(p(6))
Button7.Top = t(p(7))
Button7.Left = l(p(7))
Button8.Top = t(p(8))
Button8.Left = l(p(8))
Button9.Top = t(p(9))
Button9.Left = l(p(9))
Button10.Top = t(p(10))
Button10.Left = l(p(10))
Button11.Top = t(p(11))
Button11.Left = l(p(11))
Button12.Top = t(p(12))
Button12.Left = l(p(12))
Button13.Top = t(p(13))
Button13.Left = l(p(13))
Button14.Top = t(p(14))
Button14.Left = l(p(14))
Button15.Top = t(p(15))
Button15.Left = l(p(15))
Button16.Top = t(p(16))
Button16.Left = l(p(16))










PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
m = False
Button1.ImageIndex = 1
Button2.ImageIndex = 1
Button3.ImageIndex = 2
Button4.ImageIndex = 2
Button5.ImageIndex = 3
Button6.ImageIndex = 3
Button7.ImageIndex = 4
Button8.ImageIndex = 4
Button9.ImageIndex = 5
Button10.ImageIndex = 5
Button11.ImageIndex = 6
Button12.ImageIndex = 6
Button13.ImageIndex = 7
Button14.ImageIndex = 7
Button15.ImageIndex = 8
Button16.ImageIndex = 8

safasoft
شنبه 23 تیر 1386, 14:21 عصر
برای اینکه از داخل بانکم بصورت رندوم تعدادی از اقلام را انتخاب کنم چه کار کنم ؟
از کمکتون سپاسگذارم

علی علیرضائی
شنبه 23 تیر 1386, 16:49 عصر
برای اینکه از داخل بانکم بصورت رندوم تعدادی از اقلام را انتخاب کنم چه کار کنم ؟
از کمکتون سپاسگذارم
شما میتونی از 1 تا تعداد رکوردات یه عدد رندوم انتخاب کنی بعد تو select اون رکورد رو بخونی
کاملا رندوم میشه

__________________________________
انجمن مهندسان فعال (http://www.eaclub.com)

MM_Mofidi
شنبه 23 تیر 1386, 17:19 عصر
یک select بنویس که یک فیلد با مقدار رندم اضافه داشته باشه بر اساس اون مرتب کن و top N آن را بعنوان خروجی ارائه بده.

senator_aka
شنبه 23 تیر 1386, 23:41 عصر
دوست عزیز یه سر به آدرس زیر بزن:

http://barnamenevis.org/forum/showthread.php?t=72660