Feature #18851
closedAdd StdWrap feature "random Number"
0%
Description
stdWrap lacks support for generatiung a random number between to points set.
asking for Introducing a feature:
stdWrap.random = lowerBound|UpperBound|Precision
with
lowerBound=smallest possible Value
upperBound=highest possible Value
precision= 0 , 1 or 2 point out number of decimals the value can have
Would be useful in such a case:
...COA_INT
10 = CASE
10 {
key.random = 0|5|0
1 =TEXT1
2=TEXT2
3=TEXT3
4=TEXT2
5=TEXT3
}
implementation will follow the next days
(issue imported from #M8514)
Files
Updated by Benni Mack over 16 years ago
Why just a number?
I'd love to use this for password / hash generation as well :)
stdWrap.random = number
or
stdWrap.random = string
stdWrap.random.minLength = 5
stdWrap.random.maxLength = 20
or :
stdWrap.hash = md5
Updated by Sigfried Arnold over 13 years ago
Why not adding an stdWrap feature for evakuation PHP directly?
stdWrap.evalPHP = md5(uniqid());
Of course would be probably a security issue.
Updated by Frederic Gaus over 13 years ago
For discussion: Just added a simple implementation. I could complete/enlarge it. But it solves the TS sample Steffen posted.
Updated by Xavier Perseguers over 13 years ago
- Category deleted (
Communication) - Target version deleted (
4.6.0-beta1)
Updated by Ingo Renner almost 13 years ago
patch works for me
number_int = TEXT number_int { randomNumber { min = -5 max = 5 } }
Updated by Stefan Neufeind over 10 years ago
- Category set to TypoScript
- TYPO3 Version changed from 4.2 to 6.2
- PHP Version deleted (
5.2)
random might also be useful to just generate a md5-like random string. If you want, maybe give it a charset-parameter from which to take chracters for the random-generation. If you want things like "always starts with a letter" you could use two random strings (one just a-z, the other a-z0-9 or so).
Updated by Benni Mack almost 10 years ago
- Status changed from New to Resolved
this can be easily achieved nowadays:
10 = TEXT
10.value = -1,-2,-3,-4,0,1,2,3,4
10.listNum = rand
the hashing works with
10.hash = md5