Feature #18851
closed
Add StdWrap feature "random Number"
Added by Steffen Ritter over 16 years ago.
Updated about 6 years ago.
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
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
Why not adding an stdWrap feature for evakuation PHP directly?
stdWrap.evalPHP = md5(uniqid());
Of course would be probably a security issue.
For discussion: Just added a simple implementation. I could complete/enlarge it. But it solves the TS sample Steffen posted.
- Category deleted (
Communication)
- Target version deleted (
4.6.0-beta1)
patch works for me
number_int = TEXT
number_int {
randomNumber {
min = -5
max = 5
}
}
- 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).
- 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
- Status changed from Resolved to Closed
Also available in: Atom
PDF