<div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno gio 21 mar 2019 alle ore 16:01 T Lee Davidson <<a href="mailto:t.lee.davidson@gmail.com">t.lee.davidson@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 3/21/19 8:22 AM, Gianluigi wrote:<br>
> Hi,<br>
> can this be a correct use of the array Shuffle method?<br>
> <br>
> [code]<br>
> Public Sub Main()<br>
> <br>
> Dim aBingo As New Byte[]<br>
> Dim iPull As Byte<br>
> <br>
> For i As Byte = 0 To 89<br>
> aBingo.Push(i + 1)<br>
> Next<br>
> aBingo.Shuffle()<br>
> iPull = aBingo[aBingo.Max]<br>
> Print "Extract "; iPull; "\n"<br>
> aBingo.Resize(aBingo.Max - 1)<br>
> '-------------------------------<br>
> Print "Checking:"<br>
> aBingo.Sort()<br>
> For Each i In aBingo<br>
> Print i<br>
> Next<br>
> <br>
> End<br>
> [/code]<br>
> <br>
> Regards<br>
> Gianluigi<br>
<br>
According to the Wiki, Byte[] has a Shuffle method. But, when I try to run your code, I get:<br>
"Unknown symbol 'Shuffle' in class 'Byte[]'" Same thing on the Gambas Playground: <a href="http://gambas.one/playground/ultra.php" rel="noreferrer" target="_blank">http://gambas.one/playground/ultra.php</a><br>
<br>
Other than that, I think your use of the shuffle method would be a correct use. Although, you should be able to simply use:<br>
<br>
iPull = aBingo.Extract(aBingo.Max)<br>
<br>
instead of:<br>
<br>
iPull = aBingo[aBingo.Max]<br>
aBingo.Resize(aBingo.Max - 1)<br>
<br>
<br>
___<br>
Lee<br>
<br></blockquote><div><br></div><div>Hi Lee,</div><div>For Shuffle to work, it is necessary to have the last master 2bb7d795<br>Regarding the code: Extract returns an array not a number.</div><div><br></div><div>Regards</div><div>Gianluigi<br></div></div></div></div>