:orphan:
# DMSwarmSetPointCoordinatesRandom
Sets initial coordinates for particles in each cell 
## Synopsis
```
#include "petscdmswarm.h"   
PetscErrorCode DMSwarmSetPointCoordinatesRandom(DM dm, PetscInt Npc)
```
Collective


## Input parameters

- ***dm  -*** the `DMSWARM`
- ***Npc -*** The number of particles per cell in the cell `DM`





## Notes
The user must use `DMSwarmSetCellDM()` to set the cell `DM` first. The particles are placed randomly inside each cell. If only
one particle is in each cell, it is placed at the centroid.


## See Also
 `DM`, `DMSWARM`, `DMSwarmSetCellDM()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/swarm/swarm.c.html#DMSwarmSetPointCoordinatesRandom">src/dm/impls/swarm/swarm.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex77.c.html">src/ts/tutorials/ex77.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/swarm/swarm.c)


[Index of all DMSwarm routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
