Project

General

Profile

Actions

Feature #18851

closed

Add StdWrap feature "random Number"

Added by Steffen Ritter over 16 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2008-05-26
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

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

M8514.diff (1.24 KB) M8514.diff Administrator Admin, 2011-03-24 17:02

Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Feature #23534: Feature Proposal: add "rand" value to listNumClosed2010-09-13

Actions
Actions #1

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

Actions #2

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.

Actions #3

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.

Actions #4

Updated by Xavier Perseguers over 13 years ago

  • Category deleted (Communication)
  • Target version deleted (4.6.0-beta1)
Actions #5

Updated by Ingo Renner almost 13 years ago

patch works for me

number_int = TEXT
number_int {
  randomNumber {
    min = -5
    max = 5
  }
}
Actions #6

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).

Actions #7

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

Actions #8

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF