Advertisement
Haubitze

Simple Name-Generator

May 30th, 2019
1,090
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function get_sysname(seed As uinteger) As String
  2.     Dim n As String
  3.     'this is the magic bible code (a german bibel translated by Martin Luther)
  4.     Dim magic1(0 To 25) As UInteger={192820,56937,83962,157213,483371,27962,75240,140118,241061,11546,27544,91242,56951,178568,79338,18286,134,138139,168794,97790,136722,25685,56046,26,1231,30769}
  5.     Dim magic2(0 To 25,0 To 25) As Integer = { _
  6.     {1113,14697,13435,2855,15494,1532,7002,6037,949,317,855,15258,8425,26601,583,548,6,14254,27595,9836,23264,1459,21,6,-1,678}, _
  7.     {4419,284,-1,93,32596,50,298,100,4204,62,24,2013,12,141,2350,-1,-1,5097,1453,2192,1309,2,55,-1,18,165}, _
  8.     {17,-1,-1,-1,3,-1,-1,81017,7,-1,2913,-1,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,-1}, _
  9.     {31313,92,2,322,84296,85,37,61,26185,37,14,459,49,290,2068,50,-1,1469,628,2143,7287,80,43,-1,-1,203}, _
  10.     {954,13694,7768,7028,2011,2995,8699,17113,60018,43,1191,20446,17345,123996,278,1047,3,124477,41049,18142,10687,628,2938,14,-1,807}, _
  11.     {2995,42,-1,23,8295,1232,389,183,1172,-1,52,1849,83,169,670,1,-1,3108,371,2258,4690,-1,36,-1,-1,344}, _
  12.     {3119,74,-1,175,46942,137,186,37,2342,-1,770,2882,15,1174,5783,1,-1,3280,1392,4946,1210,1,29,-1,734,11}, _
  13.     {23045,67,-1,97,36468,60,75,61,6949,79,318,4818,5566,10856,5191,14,-1,17148,1712,22732,2892,-1,1721,-1,20,229}, _
  14.     {1148,2954,32812,5072,49287,912,12512,17346,2,25,135,8515,5607,57670,301,253,-1,11731,19763,14391,302,23,31,11,-1,258}, _
  15.     {3566,-1,-1,-1,4132,-1,-1,-1,65,-1,-1,-1,-1,-1,1756,-1,-1,-1,-1,-1,2027,-1,-1,-1,-1,-1}, _
  16.     {3543,14,3,1,7258,5,15,63,3169,3,113,1207,26,1310,7423,1,-1,1025,377,1156,806,1,10,-1,7,8}, _
  17.     {10130,2309,2037,2254,22320,870,591,76,9976,154,2846,18446,374,828,2972,20,-1,38,5218,6773,2496,11,36,-1,26,441}, _
  18.     {9881,80,-1,305,17572,14,172,405,12202,19,127,382,7013,112,3139,530,-1,117,866,1675,2269,-1,15,-1,29,27}, _
  19.     {9129,721,68,70844,33226,1052,10197,415,15091,302,2240,388,222,12296,2133,122,2,612,7346,6939,2519,109,389,-1,14,2192}, _
  20.     {614,2216,3565,1683,11519,710,1176,5708,15,116,86,11236,4698,10927,-1,2210,1,10705,4612,7414,2,31,34,-1,-1,60}, _
  21.     {671,-1,-1,-1,1354,2456,-1,2530,387,-1,-1,249,-1,14,419,280,-1,8207,121,1378,220,-1,-1,-1,-1,-1}, _
  22.     {-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,133,-1,-1,-1,-1,-1}, _
  23.     {16142,2783,2295,11698,27114,1828,3297,1627,10736,206,2211,2006,1453,11998,4938,134,59,10195,6914,9151,7645,117,1108,-1,7,2477}, _
  24.     {11316,281,13566,119,34536,121,741,485,20798,58,351,188,138,33,16885,7254,-1,3610,21873,32571,3399,70,130,-1,271,-1}, _
  25.     {9255,184,2,49,50432,138,385,3054,3762,23,24,1202,181,222,3086,-1,-1,4841,1830,11071,3992,19,1206,-1,91,2741}, _
  26.     {316,1702,7467,1907,20103,9036,2456,783,78,57,223,1660,6873,61188,2,689,-1,5591,11786,4413,2,222,27,-1,-1,141}, _
  27.     {1836,-1,-1,-1,6220,-1,-1,-1,3339,5,-1,12,-1,7,14259,-1,-1,-1,1,-1,-1,6,-1,-1,-1,-1}, _
  28.     {12976,-1,-1,-1,17277,-1,-1,-1,17051,1,-1,-1,-1,-1,6496,-1,-1,-1,1,-1,2242,-1,2,-1,-1,-1}, _
  29.     {10,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6,9,-1,-1,-1,-1,-1,-1}, _
  30.     {5,2,7,5,8,-1,4,-1,-1,-1,2,19,5,6,1,747,-1,385,20,2,-1,-1,-1,12,-1,1}, _
  31.     {1025,18,-1,-1,7357,1,5,25,2504,40,6,94,22,2,1435,50,-1,48,19,987,15284,3,1829,-1,12,3} _
  32.     }
  33.     Randomize seed'set the seed
  34.     Dim m0 As UInteger=Int(Rnd*26)'get a letter
  35.     Dim m1 As UInteger=Int(Rnd*26)'get a folowing letter
  36.     Dim l As UInteger=2+Int(Rnd*6)'set the lenght of the name
  37.     For i As UInteger=0 To l'loop over name lenght
  38.         Dim chance As Double=magic2(m0,m1)/magic1(m0)'set the chance that the folowing letter appiers
  39.         While Rnd>chance'if chance is to low get a new folowing letter
  40.             m1=Int(Rnd*26)
  41.             chance=magic2(m0,m1)/magic1(m0)'and set the chance to the new value
  42.         Wend
  43.         n+=Chr(m0+97)'add first letter to the string
  44.         m0=m1'set first letter to the folowing letter
  45.     Next
  46.     n[0]-=32'make the most first letter upper case
  47.     'Print n
  48.     Return n
  49. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement