> For the complete documentation index, see [llms.txt](https://reflective-roommanager.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://reflective-roommanager.gitbook.io/docs/user-manual/identifier/uniqueidentifier.md).

# UniqueIdentifier

The purpose of this class is to create unique identifiers. In this way, it allows us to create labels that identify different things such as goods and objects in various places.

### Members

`private readonly Random _random;`

* It holds the random class that will ensure randomness.

`private readonly HashSet<uint> _usedIds;`

* It keeps the used ids in a HasSet so that we know the previously used ids.

`private readonly _idLenght;`

* It holds the length information of the id to be created.

### Methods

* ```csharp
  public UniqueIdentifier(int idLength)
  ```
  * It allows us to specify the length of the id when creating the class.
* ```csharp
  public bool IsIDUnique(uint ID)
  ```
  * It is checked whether the sent ID is in the list or not.
  * If the value is in the list, it returns false.
* ```csharp
  public uint CreateID()
  ```
  * It creates a unique ID and if this ID is in the list, it creates it again.
  * If the ID is not in the list, it adds it to the \_usedIds list and returns the Id.
* ```csharp
  private uint GenerateUniqueID()
  ```
  * Fisher-Yates Suffle algorithm was used for randomness.
  * A list is created for all numbers between 0 and 10. (0..10)
  * The length of the digits is assigned to a variable (n) and a loop is run until this variable becomes 0.
  * n is decreased at each stage. A random number up to n+1 is generated and assigned to a variable named k.
  * Then, the number in the list of digits corresponding to k is replaced by the number in the list of digits corresponding to n.
  * thus the numbers are scrambled.
  * Then a for loop is started for the length of \_idLenght.
  * Each time, the uniqueID variable is multiplied by 10 and the element at index i in the digits list is added.
  * and this value is returned.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://reflective-roommanager.gitbook.io/docs/user-manual/identifier/uniqueidentifier.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
