Loading ...
Sorry, an error occurred while loading the content.

Re: [Clip] Re: Searching variables with regex?

Expand Messages
  • Sheri
    ... Hi Dio. Statistics is not my forte, called it Sadistics when I took that course. :D I can see from your test clip that mine does skew toward the 2nd
    Message 1 of 35 , Oct 6, 2010
    • 0 Attachment
      On 10/5/2010 1:50 PM, diodeom wrote:
      > I wrote:
      >> ^!Set %n%=^$Calc(FLOOR(RND(^%ar0%)+1))$
      >>
      > If of interest to anyone, I utilized the following makeshift clip to better test "fairness" of various randomizing takes:
      >
      > ;Number of random numbers to generate +1
      > ^!Set %i%=1001
      > ;Number of alternatives (array elements), min 2/max 8
      > ^!Set %alt%=3
      > :Rand
      > ^!Dec %i%
      > ^!If ^%i%=0 Count
      > ;Variants of getting random numbers
      > ^!Set %method%=^$Calc(FLOOR(RND(^%alt%)+1))$
      > ;^!Set %method%=^$Calc(RND(^$Calc(^%alt%-1)$)+1;0)$
      > ;^!Set %method%=^$Calc(CEIL(RND(^%alt%)))$
      > ^!Append %rnd%=^%method%
      > ^!Goto Rand
      > :Count
      > ^!Inc %i%
      > ^!If ^%i%>^%alt% Done
      > ^!Set %h%=^$StrCount(^%i%;^%rnd%;0;0)$
      > ^!Append %res%=Alt ^%i%: ^%h% hits
      > ^!Append %res%=, ^$Calc(^%h%/^$StrSize(^%rnd%)$*100;2)$%^%nl%
      > ^!Goto Count
      > :Done
      > ^!Info [L]^%res%
      > ^!Set %i%=; %alt%=; %method%=; %rnd%=; %h%; %res%=
      >
      > For a more accurate illustration, this obviously could be furthered to average data collected from multiple runs.
      >

      Hi Dio. Statistics is not my forte, called it Sadistics when I took that
      course. :D

      I can see from your test clip that mine does skew toward the 2nd
      alternative with 3 options.

      Thought I was putting the case into the formula provided. The +1 does
      not mean add one, it means start the range from positive 1. The ;0 means
      use zero decimal places. Problem was, without subtracting one from
      ^%ar0% (where ^%ar0% was 3) the outcome was 4 two or three times per
      thousand executions. So my (poor) solution was to subtract 1 from ^%ar0%.

      Your Floor solution seems ok, but are you certain there is no absolutely
      no possibility the outcome would ever be 4 in the same circumstance
      (i.e., where the range of options is (or at least should be) 3?

      Regards,
      Sheri
    • Paul
      See? There s always someone ready to apply the rules even when I thought I was doing something harmless?!! sry bout that.. point taken. will visit
      Message 35 of 35 , Oct 11, 2010
      • 0 Attachment
        See? There's always someone ready to apply the rules even when I thought I was doing something harmless?!! <ahem> sry 'bout that.. point taken. will visit over there.....

        --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
        >
        > Paul wrote:
        > > I only stiffly object to copied work when it is purported to be
        > > ones own work. In the early stages of professional development
        > > I advocate reprimand and retraining.
        >
        > This is beginning to drift off the topic od clips, My answer certainly
        > is, which is why I just posted it to the off-topic list.
        >
        > Axel
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.