I am still not sure what do you want, but I guess you are talking about roots. Ok, lets consider a class of linear equations. They have only two parameters: $ax+b = 0$. Choosing randomly $\hat{x} = 0,1,...,9$ you have a condition on $a$ and $b$: $a\hat{x}+b = 0$. for this class you can only randomly choose one of the variables (preferably, $b$ not to make $a$ equal to zero).
Example. $x = 2$, then $2a+b = 0$. You make $b = rand(0,100)$ and $a = -0.5 b$. then the solution will be $x=2$ as it was desired.
You can also consider another class - but note that you would like to have a unique solution. Say, for quadratic equation you may want to say "find the positive root of an equation". Then algorithm is the following: choose $\hat{x} = 0,1,...,9$ and x' to be a negative number (preferably integer also). Then any equation of the form a(x-\hat{x})(x-x') = 0 has desired roots. For this equation you can choose independently $a$ (any) and x' (negative). To make it more tough, open the brackets after the choice of all parameters.
Example. We choose again $\hat{x} = 2$ and $a = rand(0,12)$ and x' = -rand(0,100). then we have an equation ax^2 - (2+x')x + 2x' = 0.