Imagine I have $N$ spaces. Each space can be empty, or occupied. Given a fixed point value $x$ between zero and one, I would like to evenly populate the $N$ spaces such that $\frac{N_{\text{occupied}}}{N}$ is approximately equal to $x$. The purpose of the even distribution is such that the average rate of encountering occupied spaces when traversing the spaces follows $x$.
I understand that $\left \lfloor{N \cdot x}\right \rfloor$ will give me the number of spots to fill. But how do I algorithmically distribute them most evenly within the $N$ spaces? Is there any way to do this "cleanly"?
I've considered doing this with a boolean pseudorandom number generator with mean $x$, but I'm worried that wouldn't give optimal reliability and precision. Ideally the solution would not be very computationally intensive. Thank you so much.

Let $p$ be the proportion that you want filled, i.e., $p = \frac{N_{occupied}}N$. Leave the first space empty if $p<1$; otherwise, fill it.
Now let $f(k) = \lfloor pk \rfloor - \lfloor p(k-1) \rfloor$ and observe that if $k \in \mathbb Z$, then $f(k) \in \{0,1\}$. Use $f(k)$ as an indicator for filling the spaces for $k>1$; that is, fill the $k$th space if and and only if $f(k)=1$.
Example: say $p=0.71$ and $N=10$. Here's a table with columns $\left(k, pk, \lfloor pk \rfloor, f(k)\right)$. As you can see, a total of seven spaces are filled, and $\frac{7}{10} \approx 0.71$.