Random Tips Snippet

This snippet allow to randomly display some text. For example you can include this page from the home page of your wiki to display some tips about wiki usage.

Code

## Generates an integer between 0 and 2
## This number can be increased to 9 by modifying the line bellow
#set ($seed = $util.generateRandomString(1024).replaceAll(".*([0-2]).*", "$1"))

#if ($seed == 0)
  Tips #1
#elseif ($seed == 1)
  Tips #2
#elseif ($seed == 2)
  Tips #3
#end
Version 3.1 last modified by VincentMassol on 12/06/2008 at 11:27

Comments 1

VincentMassol | 12.06.2008 at 11:27 AM
You can also use
$mathTool.random(...)
(see http://velocity.apache.org/tools/devel/generic/MathTool.html#random())

Attachments 0

No attachments for this document

Creator: jvdrean on 2008/06/11 12:42
This wiki is licensed under a Creative Commons license
1.4.1.10194