Module:Random/doc: Difference between revisions

Content deleted Content added
add refresh links to the later examples
add anchors for the refresh links
Line 14:
* With two arguments, returns an integer in the range <math>[m,n]</math>. <code>''m''</code> and <code>''n''</code> can be either positive or negative; however, <code>''n''</code> must be greater than or equal to <code>''m''</code>, otherwise it is ignored and the module returns an integer in the range <math>[1,m]</math>.
 
'''Examples''' <small>({{purge|refresh|anchor=Number}})</small>
 
* <code><nowiki>{{#invoke:random|number}}</nowiki></code> &rarr; {{#invoke:random|number}}
Line 28:
&#123;{#invoke:random|item|''list item 1''|''list item 2''|''list item 3''|...}}
 
'''Example''' <small>({{purge|refresh|anchor=Item}})</small>
 
* <code><nowiki>{{#invoke:random|item|egg|beans|sausage|bacon|spam}}</nowiki></code> &rarr; {{#invoke:random|item|egg|beans|sausage|bacon|spam}}
Line 62:
You cannot input spaces directly to the {{para|sep}} parameter due to limitations in MediaWiki's template syntax. However, it is possible to work around this by using [[HTML entities]]. You can use <code>&amp;#32;</code> to represent a normal space, and <code>&amp;nbsp;</code> to represent a [[non-breaking space]].
 
'''Examples''' <small>({{purge|refresh|anchor=List}})</small>
 
* <code><nowiki>{{#invoke:random|list|egg|beans|sausage|bacon|spam}}</nowiki></code> &rarr; {{#invoke:random|list|egg|beans|sausage|bacon|spam}}
Line 78:
The separator can be specified with either the {{para|sep}} or {{para|separator}} parameters; its default value is "{{int:comma-separator}}". The conjunction can be specified with either the {{para|conj}} or {{para|conjunction}} parameters; its default value is " and ". The separator and the conjunction can be specified with the same values as the separator in the [[#List|list function]].
 
'''Examples''' <small>({{purge|refresh|anchor=Text list}})</small>
 
* <code><nowiki>{{#invoke:random|text_list|egg|beans|sausage|bacon|spam}}</nowiki></code> &rarr; {{#invoke:random|text_list|egg|beans|sausage|bacon|spam}}
Line 93:
! Produces
! Example code
! Example output <small>({{purge|refresh|anchor=HTML lists}})</small>
|-
| <code>bulleted_list</code>