Question: how to auto-generate random number inside the div box? and change again after refreshing the page.

**HTML code.**

```
    <div class="grid" data-row="0" data-column="0"></div>
    <div class="grid" data-row="0" data-column="1"></div>
    <div class="grid" data-row="0" data-column="2"></div>
    <div class="grid" data-row="0" data-column="3"></div>
    <div class="grid" data-row="0" data-column="4"></div>

    ......

    <div class="grid" data-row="4" data-column="0"></div>
    <div class="grid" data-row="4" data-column="1"></div>
    <div class="grid" data-row="4" data-column="2"></div>
    <div class="grid" data-row="4" data-column="3"></div>
    <div class="grid" data-row="4" data-column="4"></div>

```

**JS code**.

```
function random() {
  var x = Math.floor((Math.random() * 25) + 1);
  $(".grid").text(x);
}

```

Answer: 
Take student `arrayList` and add students data to list.

```
FirebaseAuth mFirebaseAuthInstance = FirebaseAuth.getInstance();
        FirebaseDatabase mFirebaseDatabase = FirebaseDatabase.getInstance();
        FirebaseUser mFirebaseCurrentUser = mFirebaseAuthInstance.getCurrentUser();
        DatabaseReference mDatabaseRef = mFirebaseDatabase.getReference("User").child(mFirebaseCurrentUser.getUid()).child("Student");
        mDatabaseRef.addValueEventListener(new ValueEventListener() {

            @Override
            public void onDataChange(DataSnapshot snapshot) {

                ArrayList<Student> studentList=new ArrayList<Student>();
                for (DataSnapshot postSnapshot : snapshot.getChildren()) {
                    Student student = postSnapshot.getValue(Student.class);
                    studentList.add(student);
                }
            }

            @Override
            public void onCancelled(FirebaseError firebaseError) {
                System.out.println("Data Access Failed" + firebaseError.getMessage());
            }
        });

```

Use `RecylerView` to load data to xml,refer the below link to use `RecylerView`

> 
> More [reference](https://www.androidhive.info/2016/01/android-working-with-recycler-view/)
> 
> 
>
**Try this**

```
public class FethingDatas extends AppCompatActivity {

    RecyclerView ry_fetchdata;

    Firebase firebase;

    ArrayList<Pojo_Recylerview> arrayList = new ArrayList<>();

    Pojo_Recylerview pojo_recylerview_obj;

    Display_Adapter display_adapter;

    private RecyclerView.LayoutManager layoutManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fething_datas);

        ry_fetchdata = findViewById(R.id.ry_fetchdata);

        firebase = new Firebase("https://fir-project-87eac.firebaseio.com/").child("Userdata");

        layoutManager = new LinearLayoutManager(this);
        ry_fetchdata.setLayoutManager(layoutManager);
        ry_fetchdata.setItemAnimator(new DefaultItemAnimator());
        display_adapter = new Display_Adapter(this,arrayList);
        ry_fetchdata.setAdapter(display_adapter);

        firebase.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {

                if (dataSnapshot.exists())
                {

                    arrayList.clear();

                    for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren())
                    {

                        String subject= (String) dataSnapshot1.child("subject").getValue();
                        String username = (String) dataSnapshot1.child("username").getValue();

                        pojo_recylerview_obj = new Pojo_Recylerview();

                        Log.d("subject","username"+subject +" "+username);

                        pojo_recylerview_obj.setSubject(subject);
                        pojo_recylerview_obj.setUsername(username);

                        arrayList.add(pojo_recylerview_obj);

                    }

                    display_adapter.notifyDataSetChanged();

                }else
                {
                    Toast.makeText(FethingDatas.this,"No More Data Found",Toast.LENGTH_LONG).show();
                }

            }

            @Override
            public void onCancelled(FirebaseError firebaseError) {

            }
        });

    }
}

```