Generate a set of random unique integers from an interval

后端 未结 3 1584
离开以前
离开以前 2021-02-03 21:31

I am trying to build some machine learning models,

so i need a training data and a validation data

so suppose I have N number of examples, I want to select rando

3条回答
  •  旧时难觅i
    2021-02-03 21:57

    from the raster package:

    raster::sampleInt(242, 10, replace = FALSE)
    ##  95 230 148 183  38  98 137 110 188  39
    

    This may fail if the limits are too large:

    sample.int(1e+12, 10)
    

提交回复
热议问题