Difference between revisions of "Talk:Rand"
Jump to navigation
Jump to search
imported>Jtech13 (New page: How do I add a random number of items with this script? Like player.additem 0000000f <rand function> How would i do that?) |
imported>DragoonWraith |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
How would i do that? | How would i do that? | ||
:Easily. Although you may not be able to use this in the console, and the example you gave looks like it was a console command, not a script. | |||
Short randNum | |||
Set randNum To rand 0 [max] | |||
player.additem <item id> randNum | |||
== Between or between and? == | |||
A short question dose rand 1 10 return any number bigger than 1 and less than 10 or does it also include 1 and 10? | |||
:As it returns a float value with quite a few decimal places, it pretty much doesn't matter. The difference between stopping at 9.999999 and 10 is marginal, and won't affect the odds in any meaningful way. Just be sure to check like < 2, < 3, < 4, and so on, rather than ==1, ==2, etc. | |||
:[[User:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">D</span>ragoon <span style="font-family: Oblivion, Daedric Runes; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">TALK</span>]] 20:31, 18 February 2009 (EST) |
Latest revision as of 20:31, 18 February 2009
How do I add a random number of items with this script?
Like player.additem 0000000f <rand function>
How would i do that?
- Easily. Although you may not be able to use this in the console, and the example you gave looks like it was a console command, not a script.
Short randNum Set randNum To rand 0 [max] player.additem <item id> randNum
Between or between and?[edit source]
A short question dose rand 1 10 return any number bigger than 1 and less than 10 or does it also include 1 and 10?
- As it returns a float value with quite a few decimal places, it pretty much doesn't matter. The difference between stopping at 9.999999 and 10 is marginal, and won't affect the odds in any meaningful way. Just be sure to check like < 2, < 3, < 4, and so on, rather than ==1, ==2, etc.
- Dragoon Wraith TALK 20:31, 18 February 2009 (EST)