diff options
author | Brad King <brad.king@kitware.com> | 2009-11-11 18:34:21 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-11-11 18:34:21 (GMT) |
commit | d2715cae493a16e9187d8e43f36fab90e3239184 (patch) | |
tree | 3bcf711fb6ad7368171e5d33ad75de1fe0ef98a7 /Source/cmStringCommand.cxx | |
parent | 29ebc97c38a291988e1e16edcbb000bfb879825b (diff) | |
download | CMake-d2715cae493a16e9187d8e43f36fab90e3239184.zip CMake-d2715cae493a16e9187d8e43f36fab90e3239184.tar.gz CMake-d2715cae493a16e9187d8e43f36fab90e3239184.tar.bz2 |
CMake 2.8.0-rc7
Diffstat (limited to 'Source/cmStringCommand.cxx')
-rw-r--r-- | Source/cmStringCommand.cxx | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 2313853..3bd47a4 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -700,6 +700,9 @@ bool cmStringCommand return false; } + static bool seeded = false; + bool force_seed = false; + int seed = (int) time(NULL); int length = 5; const char cmStringCommandDefaultAlphabet[] = "qwertyuiopasdfghjklzxcvbnm" "QWERTYUIOPASDFGHJKLZXCVBNM" @@ -723,6 +726,12 @@ bool cmStringCommand ++i; alphabet = args[i]; } + else if ( args[i] == "RANDOM_SEED" ) + { + ++i; + seed = atoi(args[i].c_str()); + force_seed = true; + } } } if ( !alphabet.size() ) @@ -744,7 +753,13 @@ bool cmStringCommand const std::string& variableName = args[args.size()-1]; std::vector<char> result; - srand((int)time(NULL)); + + if (!seeded || force_seed) + { + seeded = true; + srand(seed); + } + const char* alphaPtr = alphabet.c_str(); int cc; for ( cc = 0; cc < length; cc ++ ) |