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

Re: Searching variables with regex?

Expand Messages
  • diodeom
    ... If of interest to anyone, I utilized the following makeshift clip to better test fairness of various randomizing takes: ;Number of random numbers to
    Message 1 of 35 , Oct 5, 2010
    • 0 Attachment
      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.
    • 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.