Should I Use Path.GetRandomFileName or use a Guid?

百般思念 提交于 2019-12-10 02:30:39

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/22625677/should-i-use-path-getrandomfilename-or-use-a-guid

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!