quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../images/main/bulllet_4dots_orange.gif randcase

The randcase statement specifies a block of statements, one of which is executed randomly. Personally I never used this feature of Vera.

   

space.gif

Syntax : randcase

   

space.gif

randcase {
  weight1 : statement1
  weight2 : statement2
  ...
  weightN : statementN
}
   

space.gif

   

space.gif

  ../images/main/bullet_star_pink.gif Example : randcase
   

space.gif


  1 program randcase_statement {
  2   // You need to run for more iteration to
  3   // get proper distribution
  4   repeat(10) {
  5     do_randcase();
  6   }
  7 }
  8 
  9 task do_randcase() {
 10   randcase {
 11     20 : {
 12            printf ("What should I do ? \n");
 13          }
 14     20 : {
 15            printf ("Should I work\n");
 16          }
 17     20 : {
 18            printf ("Should I watch Movie\n");
 19          }
 20     40 : {
 21            printf ("Should I complete tutorial\n");
 22          }
 23 
 24   }
 25 }
You could download file randcase_statement.vr here
   

space.gif

  ../images/main/bullet_star_pink.gif Simulation : randcase
   

space.gif

 What should I do
 What should I do
 Should I work
 Should I complete tutorial
 Should I complete tutorial
 What should I do
 What should I do
 Should I work
 Should I work
 Should I work
   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright © 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com