source: main/waeup.sirp/trunk/src/waeup/sirp/tests/util.py @ 9819

Last change on this file since 9819 was 7193, checked in by Henrik Bettermann, 13 years ago

More copyright adjustments.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1## $Id: util.py 7193 2011-11-25 07:21:29Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18import random
19
20def get_randstring(length):
21    result = ''
22    for i in range(1, length):
23        result += random.choice('abcdefghijklmnopqrstuvwxyz')
24    return result
25
26def get_randname():
27    result = ''
28    n1 = get_randstring(random.randint(4, 15))
29    n2 = get_randstring(random.randint(4, 15))
30    n3 = get_randstring(random.randint(4, 15))
31    #n1[0] = n1[0].upper()
32    #n2[0] = n2[0].upper()
33    #n3[0] = n3[0].upper()
34    return '"%s %s %s"' % (n1, n2, n3)
35
36def get_namelist(num):
37    return [get_randname() for x in range(0, num)]
38
39random.seed()
40fd = open('namelist.txt', 'w')
41for name in get_namelist(70000):
42    fd.write(name + '\n')
43fd.close()
Note: See TracBrowser for help on using the repository browser.