# Rand() function bug always naming first and second 0041 and 1846

**URL:** https://community.mp3tag.de/t/rand-function-bug-always-naming-first-and-second-0041-and-1846/56760
**Category:** Fixed Bugs
**Tags:** bug-fixed
**Created:** [March 22, 2022, 1:37am UTC](https://community.mp3tag.de/t/rand-function-bug-always-naming-first-and-second-0041-and-1846/56760 "2022-03-22T01:37:19Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ipqp23](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/i/7bcc69/32.png) [@ipqp23](https://community.mp3tag.de/u/ipqp23)
#### Post date: [March 22, 2022, 1:37am UTC](https://community.mp3tag.de/t/rand-function-bug-always-naming-first-and-second-0041-and-1846/56760/1 "2022-03-22T01:37:19Z")

</div>

![Untitled](https://community.mp3tag.de/uploads/default/original/2X/9/99efe26af4d928fbf1d2f982b8986a8c2ce4cc7d.png)  
 ![Untitled1](https://community.mp3tag.de/uploads/default/original/2X/7/780fab89f9748dc82d2948b02a388c40cd944d59.png)  
i am converting tag to filename using $num($left($rand(),4),4) %artist% - %title%  
but 1st and 2nd file is not random number even if it shows diff number it will save as  
0041 %artist% - %title%.mp3  
1846 %artist% - %title%.mp3

im doing this before but with version 3.12 it is not working. thanks  
[ipqp23@gmail.com](mailto:ipqp23@gmail.com)

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [March 22, 2022, 6:41am UTC](https://community.mp3tag.de/t/rand-function-bug-always-naming-first-and-second-0041-and-1846/56760/2 "2022-03-22T06:41:56Z")

</div>

I could reproduce it.  
The first call of the $rand() function always leads to 0041.  
But then the randomizer is started, apparently, and all further calls lead to different values.  
The randonizer is reset with the next new start of MP3tag.  
So a scenario to reproduce it would be:  
Open MP3tag  
Select a couple of files  
Open Converter\>Tag-Filename,  
Enter `$num($left($rand(),4),4) %artist% - %title%`  
see in the preview the number 0041  
Open the full preview and find the second file with number 1846  
Cancel all this  
restart the Converter again to see that it shows different numbers and will do so for every further call in this session.  
Close MP3tag  
Open MP3tag and start with the first step again and the number 0041 will return as first random number.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [March 22, 2022, 9:11am UTC](https://community.mp3tag.de/t/rand-function-bug-always-naming-first-and-second-0041-and-1846/56760/3 "2022-03-22T09:11:18Z")

</div>

Thanks for pointing and the additional confirmation! I'll add more randomness with the next release.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [March 24, 2022, 11:03am UTC](https://community.mp3tag.de/t/rand-function-bug-always-naming-first-and-second-0041-and-1846/56760/4 "2022-03-24T11:03:55Z")

</div>

This is now fixed with [Mp3tag v3.13](https://community.mp3tag.de/t/455).

---

<div class="post-metadata">

### Author: ![ipqp23](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/i/7bcc69/32.png) [@ipqp23](https://community.mp3tag.de/u/ipqp23)
#### Post date: [March 24, 2022, 2:07pm UTC](https://community.mp3tag.de/t/rand-function-bug-always-naming-first-and-second-0041-and-1846/56760/5 "2022-03-24T14:07:26Z")

</div>

thank you for the effort. Mr. Dev  
I tried and it is now working.

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [April 23, 2022, 2:07pm UTC](https://community.mp3tag.de/t/rand-function-bug-always-naming-first-and-second-0041-and-1846/56760/6 "2022-04-23T14:07:53Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
