<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: По random]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10512&amp;type=atom" />
	<updated>2015-03-22T18:35:19Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10512</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: По random]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92670#p92670" />
			<content type="html"><![CDATA[<p>У меня с 3 раза выдало 2 четвёрки, и 2 тройки. Фактически вероятно выпадение 5 четвёрок из 5.<br /></p><div class="codebox"><pre><code>res := Rand(&quot;0|0|0|1|1|1|2|2|3|4&quot;)
Loop % 5
   MsgBox % res[A_Index]
Return

Rand(Str) {
   Sort, Str, Random D|
   Return StrSplit(Str, &quot;|&quot;)
}</code></pre></div><p>Или лучше так:<br /></p><div class="codebox"><pre><code>
1::
    p =
    Loop 30
        p .= Rand()
    ToolTip % p
    Return

Rand(reset=0) {
    Static Str := &quot;0|0|0|1|1|1|2|2|3|4&quot;, i := 10, Arr  
    If (i = 10 || reset)
    {
        Sort, Str, Random D|
        Arr := StrSplit(Str, &quot;|&quot;), i := 0
    }
    Return Arr[++i]
}  
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-03-22T18:35:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92670#p92670</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: По random]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92655#p92655" />
			<content type="html"><![CDATA[<p>Спасибо большое!</p>]]></content>
			<author>
				<name><![CDATA[Sekotka]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32944</uri>
			</author>
			<updated>2015-03-21T12:38:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92655#p92655</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: По random]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92654#p92654" />
			<content type="html"><![CDATA[<p>Какую присвоите, такая и будет.<br /></p><div class="codebox"><pre><code>С1 := Rand(Arr)</code></pre></div><p>При ответе предыдущий пост цитировать не нужно.</p>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2015-03-21T12:31:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92654#p92654</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: По random]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92653#p92653" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Irbis пишет:</cite><blockquote><div class="codebox"><pre><code>Arr:=[0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4]
Loop 5
   MsgBox % Rand(Arr)
Return

Rand(Arr) {
   Random, x, 1, Arr.MaxIndex()
   Return Arr[x]
}</code></pre></div></blockquote></div><p>Спасибо, а для новичка подскажите пожалуйста, какая переменная отвечает за итоговое значение? В моем примере это C1, а у вас?</p>]]></content>
			<author>
				<name><![CDATA[Sekotka]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32944</uri>
			</author>
			<updated>2015-03-21T12:28:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92653#p92653</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: По random]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92652#p92652" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Arr:=[0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4]
Loop 5
   MsgBox % Rand(Arr)
Return

Rand(Arr) {
   Random, x, 1, Arr.MaxIndex()
   Return Arr[x]
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2015-03-21T12:10:07Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92652#p92652</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: По random]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92651#p92651" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>YMP пишет:</cite><blockquote><p>Пока пост не оформите по правилам, никто вам не ответит. Оформление см. в закреплённой теме раздела.</p></blockquote></div><p>Прошу извинить. Поправил.</p>]]></content>
			<author>
				<name><![CDATA[Sekotka]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32944</uri>
			</author>
			<updated>2015-03-21T11:35:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92651#p92651</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: По random]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92650#p92650" />
			<content type="html"><![CDATA[<p>Пока пост не оформите по правилам, никто вам не ответит. Оформление см. в закреплённой теме раздела.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2015-03-21T11:32:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92650#p92650</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: По random]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92649#p92649" />
			<content type="html"><![CDATA[<p>Простой вопрос от новичка.</p><p>Нужно совершить в определенной зависимости клики.</p><p>Как вместо, где берется произвольное число от 0 до 4.<br /></p><div class="codebox"><pre><code>Random, C1, 0, 4</code></pre></div><p>получить random, где выбирается один из вариантов, допустим<br /></p><div class="codebox"><pre><code>0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4  </code></pre></div><p>чтобы 0 и 1 встречался чаще остальных?</p><p>Спасибо.</p>]]></content>
			<author>
				<name><![CDATA[Sekotka]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32944</uri>
			</author>
			<updated>2015-03-21T11:17:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92649#p92649</id>
		</entry>
</feed>
