~matthias-leich/randgen/rqg-exp

« back to all changes in this revision

Viewing changes to lib/GenTest/Grammar.pm

  • Committer: Philip Stoev
  • Date: 2009-10-22 09:07:16 UTC
  • mfrom: (60.1.6 randgen)
  • Revision ID: pstoev@mysql.com-20091022090716-e4zs82sicmaotruh
merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
334
334
    my %newRuleset;
335
335
 
336
336
    my $i = 0;
337
 
    my $prng;
 
337
    my $prng = GenTest::Random->new(seed => $mask);
 
338
    ## Generate the first 16 bits.
 
339
    my $mask16 = $prng->uint16(0,0x7fff);
338
340
    foreach my $rulename (sort keys %$rules) {
339
341
        my $rule = $self->rule($rulename);
340
342
        my $components = $rule->components();
341
343
        my @components = @$components;
342
344
        my @newComponents;
343
345
        foreach my $x (@components) {
344
 
            push @newComponents, $x if (1 << ($i++)) & $mask;
 
346
            push @newComponents, $x if (1 << ($i++)) & $mask16;
345
347
            if ($i % 16 == 0) {
346
348
                # We need more bits!
347
349
                $i = 0;
348
 
                $prng = GenTest::Random->new(seed => $mask) 
349
 
                    if not defined $prng;
350
350
                $mask = $prng->uint16(0,0x7fff);
351
351
            }
352
352
        }