KySoto

fixed code

Oct 13th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.69 KB | None | 0 0
  1. private sub RandomGenerator(byval argGender as boolean)
  2. dim num as integer
  3. if argGender then
  4.     num = malenames.length()
  5. else
  6.     num = femalenames.length()
  7. end if
  8. dim x , mix , mix2,temp as integer
  9. dim randarray(num) as integer
  10. dim randnum as random = new random()
  11.  
  12. for x = 0 to num step 1
  13.     randarray(x) = x
  14. next x
  15.  
  16. for x = 0 to num step 1
  17.     mix = randnum.next(0,num)
  18.     mix2 = randnum.next(0,num)
  19.     temp = randarry(mix)
  20.     randarry(mix) = randarray(mix2)
  21.     randarray(mix2) = temp
  22. next x
  23.  
  24. if argGender then
  25.     for x = 0 to num step 1
  26.         lstnames.items.add(malenames(randarry(x)))
  27.     next x
  28. else
  29.     for x = 0 to num step 1
  30.         lstnames.items.add(femalenames(randarry(x)))
  31.     next x
  32. end if
  33. end sub
Advertisement
Add Comment
Please, Sign In to add comment