# How to randomly populate values as a new column?

**URL:** <https://community.exploratory.io/t/how-to-randomly-populate-values-as-a-new-column/1739>\
**Category:** HowTo\
**Created:** [August 28, 2019, 4:50pm UTC](https://community.exploratory.io/t/how-to-randomly-populate-values-as-a-new-column/1739 "2019-08-28T16:50:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kan\_Nishida](https://community.exploratory.io/user_avatar/community.exploratory.io/kan_nishida/32/14_2.png) [@Kan\_Nishida](https://community.exploratory.io/u/Kan_Nishida)\
**Post date:** [August 28, 2019, 4:50pm UTC](https://community.exploratory.io/t/how-to-randomly-populate-values-as-a-new-column/1739/1 "2019-08-28T16:50:53Z")

</div>

Let’s say you have a data frame with 1000 rows, and you want to populate a column with values ranging from 1 to 12 (like month number).

You can use ‘runif’ function to randomly populate the values, which will be between 0 and 1, multiply by 12 to make the values between 0 and 12, then use ‘ceiling’ function to round up the values so that they’ll be integer values.

Here is the how the calculation look like.

```auto
ceiling(runif(n())*12)

```

Here’s in Exploratory.

 ![image](https://community.exploratory.io/uploads/default/original/1X/773206f775386d3f7e9dbc119eb979b64894033b.png)

This ‘runif’ function is to populate random values according to ‘uniform’ distribution, which is basically the ‘same’ frequency for all the range.

 ![image](https://community.exploratory.io/uploads/default/original/1X/f1ff167a11c322d4258e4b473f5abf09686bc66f.png)

If you want to use different distributions such as Normal distribution, then you can use ‘rnorm’ function instead.

```auto
ceiling(rnorm(n())*12)

```

 ![image](https://community.exploratory.io/uploads/default/original/1X/1595377e48a0de9f0fb45cb5000249cfa7132f15.png)
