how to get the value from the array randomly

gorgeous yayuan geng gusunny1 at gmail.com
Fri Nov 8 03:21:48 UTC 2013


Dear Sihua,

c = random(a(1), a(4)) . I think this code is the reason. You originally
want to get a random number from 6,3,7,2,which is in the array a, but your
code is to select a value randomly from 6 to 2, which means you get a
random value from 2,3,4,5,6. and I wonder if you can successfully complie
the code since random function needs the first parameter as min, the second
parameter as max.
so I would recommend that you get a random value from 1,2,3,4 .I'd better
give you codes:
t=random(1,4)
c=a(t);
s=random(1,3)
d=b(s)




2013/11/8 sihua xu <xusihua80 at gmail.com>

> Hello everyone
>
>   I know how to define the array with the help of David and sally, and I
> get the value randomly according to way that they told me, but actually,  I
> found the program do not get the value of the array randomly and i do not
> know the reason.
> I want to achieve the purpose of the following
>  to get one value from each array and decide to end or continue the
> program by comparing the size of the value from the two arrays. the script
> example  just as follows
> dim a(1 to 4) as integer
> dim b (1 to 3) as integer
> dim c as integer
> dim d as integer
> dim randompik as integer
> a(1) = 6
> a(2) = 3
> a(3) = 7
> a(4) = 2
> b(1) = 2
> b(2)= 6
> b(3) = 4
> c = random(a(1), a(4))
> d = random(b(1), b(3))
> if c>d then
>  randompik = 1
> else randompik =2
> end if
>
> I would be grateful if anybody could help me to find the reason why it can
> not achieve my purpose and modify that
>
>
> Sihua Xu
>
>  --
> You received this message because you are subscribed to the Google Groups
> "E-Prime" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to e-prime+unsubscribe at googlegroups.com.
> To post to this group, send email to e-prime at googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/e-prime/CAPEBGuZKEQU9_P_o67iyLcPMhvy%2BYiMOQYVExDW27EXVKh2aGQ%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe at googlegroups.com.
To post to this group, send email to e-prime at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/CAJO0WNZ-t8oQ_HCLq84YJSf0Xdy7Bzq%2B7y_zjAA9rSRkZ75OJg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20131108/e6ee182e/attachment.htm>


More information about the Eprime mailing list