include.gens.creating.m
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:1k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

  1. // include.gens.creating.m
  2. //
  3. // 
  4. // Common code for simple generators
  5. // Random version 0.8
  6. // 
  7. // CREATING
  8. -runup: (unsigned) streak {
  9.    unsigned i;
  10.    unsigned bitbucket;
  11. // Draw a number of variates from the generator:
  12.    for (i=0; i < streak; i++)
  13.      bitbucket = [self getUnsignedSample];
  14.    return self;
  15. }
  16. -createEnd {
  17. // This test will disallow the use of [aGenerator create: aZone]
  18. // (user must call createBegin, setStateFromSeed, createEnd):
  19.   if (currentCount == TESTCASE) // no instantiation chosen:
  20.   [InvalidCombination raiseEvent:
  21.   "%s not Initialized with a Seed!n", genName];
  22.  
  23.   getUnsignedSample =
  24.     (unsigned (*) (id, SEL))[self methodFor: M(getUnsignedSample)];
  25.   return [super createEnd];
  26. }
  27. // 
  28. // include.gens.creating.m