Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I Use Path.GetRandomFileName or use a Guid?

Tags:

c#

path

guid

random

I need to generate unique folder names, should I use Path.GetRandomFileName or just use Guid.NewGuid?

Guids say they are globally unique, GetRandomFileName does not make such a claim.

like image 599
Aran Mulholland Avatar asked Mar 25 '14 04:03

Aran Mulholland


1 Answers

I think both are equally random, the difference being that Path.GetRandomFileName will produce a 8.3 filename (total of 11 characters) so is going to have a smaller set of unique names than those generated by Guid.NewGuid.

like image 198
NoviceProgrammer Avatar answered Nov 04 '22 01:11

NoviceProgrammer