View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0009851 | CMake | CMake | public | 2009-11-06 03:14 | 2010-11-05 12:13 | ||||
Reporter | Marcel Loose | ||||||||
Assigned To | David Cole | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake-2-6 | ||||||||
Target Version | Fixed in Version | CMake 2.8.3 | |||||||
Summary | 0009851: string(RANDOM) does not produce random string within a CMake run | ||||||||
Description | I expected that string(RANDOM...) would produce a different string each time it is invoked. Turns out that this string is only different between different cmake runs. This is not what I expected. IMHO this is a bug, either in the code, or in the documentation. $ cat ../CMakeLists.txt project(Dummy NONE) cmake_minimum_required(VERSION 2.6) string(RANDOM a) string(RANDOM b) message(STATUS "a=${a}") message(STATUS "b=${b}") $ cmake .. -- a=PgDGb -- b=PgDGb -- Configuring done -- Generating done -- Build files have been written to: /tmp/loose/cmake/build | ||||||||
Additional Information | According to David Cole this is caused by the fact that the random generator is seeded on every call to string(RANDOM...) using a one-second resolution time value as seed. Solution: only seed the random generator once. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0018362) David Cole (manager) 2009-11-06 10:20 |
Fix issue 0009851 - only seed the random number generator on the first call to STRING(RANDOM or if given the new RANDOM_SEED argument. Add test and documentation of new argument. Source/cmStringCommand.cxx Revision: 1.32 Source/cmStringCommand.h Revision: 1.31 Tests/CMakeTests/StringTestScript.cmake Revision: 1.3 |
(0022899) Marcel Loose (developer) 2010-11-05 12:13 |
I verified that this is now OK with 2.8.3. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2009-11-06 03:14 | Marcel Loose | New Issue | |
2009-11-06 09:27 | Bill Hoffman | Status | new => assigned |
2009-11-06 09:27 | Bill Hoffman | Assigned To | => David Cole |
2009-11-06 10:20 | David Cole | Note Added: 0018362 | |
2009-11-06 10:20 | David Cole | Status | assigned => resolved |
2009-11-06 10:20 | David Cole | Resolution | open => fixed |
2010-11-05 12:13 | Marcel Loose | Note Added: 0022899 | |
2010-11-05 12:13 | Marcel Loose | Status | resolved => closed |
2010-11-05 12:13 | Marcel Loose | Fixed in Version | => CMake 2.8.3 |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |