Closed (duplicate)
Project:
Token
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Apr 2008 at 01:46 UTC
Updated:
6 May 2008 at 02:09 UTC
I would like to have a token like [rand] that give me a random number ?
For different number of digits maybe [rand1] , [rand2] , [rand3] ... can be used to give a random number of 1 , 2 , 3 .. digits respectively ?
Thanks!
Comments
Comment #1
gregglesThis one probably actually belongs in token ;)
Also, I guess we could make it 1 digit long and then people could stack them together to make multiples?
Maybe providing some big groups like a [rand1] and [rand3] and [rand5] could allow people to stack them in a way that work reasonably well.
One real problem with these tokens is that the token module caches the token data for performance reasons, but if the rand values are cached that would defeat the point of the randomness. I'm not really sure how to fix that...
Comment #2
yell0w commentedI guessed a one-time-used random token would be more accurate description of what I need. Or a random nid attached to a node ?
The reason I ask for this is that I want a random 3 digit number to become sort of a 2nd nid for each node, that I can use with pathauto instead of the incremental value of nid. The randomness is only needed at the time of URL/alias creation. After that then it can be cached, etc...
Comment #3
gregglesDuplicate of #194407: Tokens for random numbers and letters and a SHA1