@Anonymous
I cannot figure out why you are going through such a complicated process to do this. A gallery displays many or all of the records in a list, it can be filtered and sorted on the columns in the list to only show selected records and/or sort them.
A single form is used to submit a new record into that list or modify a record already in the list that is selected in the gallery. The same form can also be used to show all the data in a single record as read-only by setting its display mode.
Once the record is entered or modified, the gallery will automatically show it. From your description, you have duplicated the functions and unnecessarily complicated the process. Since you describe lists, I am assuming you are using SharePoint. If so, SharePoint already assigns an ID to every record in the list that is unique, sequential and not reused. Thus, I don't understand the need for the random numbers.
Please enlighten me if I am wrong about what you are doing here and the relationship between the lists ie. one-to-many or one-to-one? What business process are you trying to duplicate in PowerApps?