xowiki::randomized_index (public)

 xowiki::randomized_index [ -seed seed ] length

Defined in packages/xowiki/tcl/xowiki-utility-procs.tcl

Return a single randomized value between 0 and length-1.

Switches:
-seed
(optional)
Parameters:
length

Partial Call Graph (max 5 caller/called nodes):
%3 test_api_randomized api_randomized (test xowiki) xowiki::randomized_index xowiki::randomized_index test_api_randomized->xowiki::randomized_index Class ::xowf::test_item::Question_manager Class ::xowf::test_item::Question_manager (public) Class ::xowf::test_item::Question_manager->xowiki::randomized_index xowf::test_item::Question_manager instproc percent_substitute xowf::test_item::Question_manager instproc percent_substitute (protected) xowf::test_item::Question_manager instproc percent_substitute->xowiki::randomized_index

Testcases:
api_randomized
Source code:
    # In case, the seed is specified, set the seed to this value to
    # achieve e.g. a stable bat random order for a user.
    #
    if {[info exists seed]} {
      expr {srand($seed)}
    }
    return [expr {int(($length-1) * rand())}]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: