简单的方法来使用随机STL数组中的条目? [英] easy way to randomize the entries of an array using stl?

查看:145
本文介绍了简单的方法来使用随机STL数组中的条目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用STL排序为int *阵列,
平原和简单的像

I can sort a int* array using stl, plain and simple like

std::sort(myarray, myarray + size);

有没有等于简单的方法来随机呢?

Is there any equal simple way to randomize it?

感谢

推荐答案

的std :: random_shuffle (myarray中,myArray的+尺寸);

这篇关于简单的方法来使用随机STL数组中的条目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆