Randomization problem

David McFarlane mcfarla9 at msu.edu
Mon May 18 19:17:58 UTC 2009


Adam,

Wow, I don't know offhand if that syntax works.  It looks like you 
are trying to use "colon syntax", and I don't know if you can use 
that with the Context.GetAttrib() method, that may work only with the 
List.GetAttrrib() method (e.g., colon syntax has to know which List 
has the attribute "Picture").  I would have to make some demo 
programs and look at the generated code to explore this further, but 
I will leave that to you.

-- David McFarlane, Professional Faultfinder


>I just realized when you sent this that it might be due to how the 
>random number is applied.
>
>I have the randomization code to select a picture for presentation, 
>so I did this:
>TestList.setAttrib counter, "Item", c.GetAttrib("Picture:drawno")
>
>...in which one of the 8 files in the attribute "Picture" on another 
>list is randomly selected.
>
>Is it defaulting to zero because this isn't syntactically valid?
>
>Adam
>
>On Mon, May 18, 2009 at 2:59 PM, David McFarlane 
><<mailto:mcfarla9 at msu.edu>mcfarla9 at msu.edu> wrote:
>
>Adam,
>
>Hmm, that bit of code works perfectly for me.  I suspect the problem
>lies somewhere else in the script.  Just to be clear, try the
>following and see what happens:
>
>Dim drawno As Integer
>Dim i as Integer
>For i = 1 to 8
>     drawno = Random(0, 7)
>     MsgBox drawno
>Next i
>
>-- David McFarlane, Professional Faultfinder
>
>
> >I'm having a little problem with randomization code in Ebasic. I
> >have this code:
> >
> >Dim drawno As Integer
> >drawno = Random(0, 7)
> >
> >...and yet, drawno is initialized to '0' every time. This code is
> >used for 8 repetitions in the program, and each time "0" comes up.
> >Even with "Randomize" in front, the same thing happens.
> >
> >Is there something I'm doing wrong?
> >
> >Adam
>
>
>
>
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en
-~----------~----~----~----~------~----~------~--~---



More information about the Eprime mailing list