# What is it?

This is tiny CUDA framework for bruting PHP `mt_srand( seed )`. This project was inspired by pyphp_rand_ocl and provides more flexibility in brute condition. Only CUDA, only hardcore.

# Example problem

Found `seed` such `randStr() === 'eddS'`:

```<?
function randStr(\$l=4){
\$ret="";
\$chars="qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM";
for(\$i=0;\$i<\$l;\$i++)    \$ret.=\$chars[mt_rand(0,strlen(\$chars))];
return \$ret;
}

mt_srand( seed );
if( randStr() === 'eddS' )
echo "You win!\n";
?>
```

# Solution

To solve add some testing code to CUDA kernel which use `mt_rand` or `mt_rand_mm` functions:

```//////////////////////////////////////////////////
//////// YOUR CODE WHICH SHOULD SET sols[ gid ]
//////////////////////////////////////////////////

/// CUDA should calculate x1, x2, x3, x4  independently (parallel).
int x1 = mt_rand_mm( seed, 0, 0, 62 );
int x2 = mt_rand_mm( seed, 1, 0, 62 );
int x3 = mt_rand_mm( seed, 2, 0, 62 );
int x4 = mt_rand_mm( seed, 3, 0, 62 );

if( (x1 == 2  ) &&   // e
(x2 == 12 ) &&   // d
(x3 == 12 ) &&   // d
(x4 == 47 ) )    // S
{
*found = true;        // indicate that we found solution
sols[ gid ] = true;   // here is solution
}
//////////////////////////////////////////////////
```

# Documentation

Currently there are two useful functions:

• `mt_rand( seed, step )` --- calculates `mt_rand` for `seed` on `step` and returns unsigned int.
• `mt_rand_mm( seed, step, min, max )` --- calculates `mt_rand` and map its answer to interval `[min, max]`.